View Full Version : How to manage dynamicaly style of Ext.Component (not Ext.element) without using CSS ?

10 Jan 2012, 11:05 PM
Hello Mitchell,
Thank you for your quick reply to my ask .How to manage dynamicaly style of Ext.element without using CSS ? (http://www.sencha.com/forum/showthread.php?173304-How-to-manage-dynamicaly-style-of-Ext.element-without-using-CSS)
However, I did a mistack with my previous ask.

I want to apply style dynamicaly on Ext.Component (not Ext.Element) like applying an icon on header of Windows, changing text to bold on a Button... without using CSS.
There is not setStyle on those objects.

I have tried it but it don't work (no such method).
myWindow.setStyle( { ( 'background-image': 'url(../icon/test.png)' ) } ) ;
if(test) myButton.setStyle( { ( 'font-weight': 'bold' ) } ) ;
else myButton.setStyle( { ( 'font-weight': 'normal' ) } ) ;
In ExtJS 2, it was possible to do something lile : myButton.addClass('boldStyle') or myButton.removeClass('boldStyle'). How I can do in ExtJS 4 ?

Any other idea ?
Thank in advance for your help.

11 Jan 2012, 2:15 PM
addCls and removeCls are the same as addClass and removeClass, just shorter names.