4 March 2011

How to change modify update css in Ext dynamically

In some rare case we need override some css rules for Ext in specific situation where css cannot be change,then ... what?
 Then you use one line of code.
Ext.util.CSS.updateRule(".x-grid3-row-alt","background-color","#00FF00");

and that's it.
However, remember that in general is bad practice to update css on the fly because all css rules should be stored css file.

Below you can find extract from extjs api (3.3.1 at time of writing this crap note) about update

updateRule( String/Array selector, String property, String value ) : Boolean
Updates a rule property

Parameters:
selector : String/Array
If it's an array it tries each selector until it finds one. Stops immediately once one is found.
property : String
The css property
value : String
The new value for the property

Returns:
Boolean
true If a rule was found and updated

www
sencha forum "regarding-Ext.util.CSS.updateRule"
extjs api (found in Class Ext.util.CSS)

No comments:

Post a Comment