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

Prachi Sinha
26 Oct 2015, 12:59 AM

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
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.

Gary Schlosberg
26 Oct 2015, 5:02 AM
Duplicate: https://www.sencha.com/forum/showthread.php?306230