PDA

View Full Version : Change a cls at the run time in Ext JS 4.1.3



Prachi Sinha
26 Oct 2015, 1:05 AM
Hi,

I have a requirement that a component should look like a combo box when it has more than one values and like a textfield when it has only one value.
Instead of changing the component. I am choosing to just change the cls of that component that will make it look like a combo box or a textfield at the run time depending on the no of items in a combobox.
To do that I am using the following
comboBox.removeCls('comboBoxWithNoImg'); comboBox.addCls('comboBoxWithImg');
But it is not working. When I inspect it at this point,it shows the changed cls in the watch (debugger) but not on the UI. Also, it seems that it is not getting refreshed or something.
I also tried the following :
comboBox.cls = 'comboBoxWithImg';
comboBox.initialCls = 'comboBoxWithImg';
comboBox.listConfig.cls = 'comboBoxWithImg';
comboBox.initialConfig.cls= 'comboBoxWithImg';
comboBox.fieldCls= 'comboBoxWithImg';
But its not changing on the UI.
Please help, I have put in a lot of time on this issue...:(
Thanks in advance.

Andreas Samjeske
26 Oct 2015, 6:32 AM
This is not Ext JS, but GXT section of forum.