PDA

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



alainparis16
10 Jan 2012, 3:56 AM
Hi,

I am facing an issue to change dynamicaly the style of some dialog element without using CSS.
I am developping a full generic user interface where Icon, bold stype of button... are manage by the server.

As an exemple, when openning a new window, the server send to the client an icon (with its full path like "/ressource/icon/test.png") and I would like to apply this Icon in the header (left) of the Ext.window.Window object that I create. There is a setIcon() method on Ext.button.Button but not in other objet !
Other exemple, I would like to change the style of a button from bold to normal based on a server answer. In ExtJS 2, it was possible to do something lile : button.addClass('boldStyle') or button.removeClass('boldStyle'). How I can do in ExtJS 4 ?

As I haw a poor knowledge about how CSS is manage, a help would be very appreciate.
Thank in advance.

mitchellsimoens
10 Jan 2012, 7:18 AM
You can use setStyle on the Ext.Element


el.setStyle('background-color', '#f00');

el.setStyle({
'background-color' : '#f00'
});