PDA

View Full Version : How to add id attribute to a div-EXTJS3



tsensuous.grace
23 Jun 2016, 2:57 PM
I have a component whose 'id' is auto-generated. I want to replace that id with my own for styling purposes. I'm unable to use class for styling as the class is used by bunch of other components.

Ext.query('.q-superdate-field')

that results into:


<input type="text" size="16" autocomplete="off" id="ext-comp-1100" name="ext-comp-1100" class="x-form-text x-form-field q-superdate-field x-form-empty-field x-trigger-noedit" readonly="" style="width: 100px;">

I want to change the width of the input field using id. Is there a way to replace exisiting 'Id' and create one of our own

Gary Schlosberg
24 Jun 2016, 2:48 PM
Rather than changing IDs, perhaps you could use the cls (http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.TextField-cfg-cls) config.
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.TextField-cfg-cls

tsensuous.grace
24 Jun 2016, 3:07 PM
so I have condition depending on which i need to add the styling class. so tried this as per suggested:



this.superclass.constructor.call(this, Ext.apply({ mode: this.mode
itemCls: this.mode == true ? 'required-datepicker' : '',
cls: 'q-superdate-field'

});


for some reason the above condition seems to be false always and hence the class is not getting added or may im doing something wrong all together. any other suggestions that could work in this case?
Thanks