View Full Version : Ext.util.CSS.updateRule not working for backgound-image?

8 Jan 2012, 2:25 PM
i am using ExtJs 4.0.7 and stumbled about this problem:

Ext.util.CSS.updateRule('.icon-gravatar', 'background-image','url(/myimage.jpg) !important');
When trying to change the background-color, everything is fine.
Updating the background-image does nothing. (manually changing the css-rule with firebug shows the expected result, so my url is working)

Why i do this:
i have to change the icon of an already rendered panel depending on runtime information. so i keep the iconCls and want to update the corresponding CSS-rule. if someone has a better idea, please let me know.

many thanks

9 Jan 2012, 9:05 AM
If you update the CSS rule itself, beware that anything that uses that CSS rule will be affected. You may want to set the style of a particular element or add a CSS rule that will modify this.

10 Jan 2012, 5:04 AM
i am aware of the consequences of my approach but i had no better idea.
panel offers a setTitle method and a setIconCls method, but no setIcon method.

As the css rules for the iconCls have to be calculated depending on user data, i have to dynamically create the css class and then change the panels iconCls. As there can only be one panel of this kind in my application i thought, using a fix iconCls and updating the corresponding rule should be easier.

anyway, i still feel this is a bug - i will have a look where to submit a bug report.