3.2.0

PLEASE HELP ON THIS. Problem (bug?) setting class dynamically

When I set a cell with a class:

obj.getCellTemplate(0,0).setClass("columnx","selected");

the entry in the CSS is:

.aw-columnx-selected {background:#ff0000;}.

The background color will only change if I make it !important:

.aw-columnx-selected {background:#ff0000!important;}

But in this case, even upon changing the class to a class with another color, the color remains in the cell.

Strangely, if I use:

obj.getCellTemplate(0,0).setClass("column","selected");

where the entry is:

aw-column-selected {background:#ff0000;}

the color changes even without the !important! And I can remove the color as I hoped. However, this changes the cell width! I can not figure this out! Please help!

Joel
December 22,
I think you're overriding something there, check all aspects of the CSS (including those that come with the grid) to check if aw-column-selected isn't defined elsewhere. If it is, you'd be able to copy/paste whatever you need but I'm not sure if this will work all the time. Remember how CSS cascades and propagate...
AcidRaZor
January 2,
Maybe there is a syntax error somewhere in your CSS which breaks the remaining part of the stylesheet?
Alex (ActiveWidgets)
January 4,
I don't think there is any error in the css. I did find that using

.aw-column-selectedx {background:#ff0000;}. instead of

.aw-columnx-selected {background:#ff0000;} solved my problem. I don't understand why.

I stopped using .aw-column-selected altogether since I can't explain that strange behavior and I don't see it used anywhere.

Joel
January 4,
if you use setClass("column", ...) it replaces the class .aw-column-0 (or whatever is the index of this column). If you have some rules attached to .aw-column-0 (for example, column width) they will no longer apply.

The priority level of CSS rules is calculated from the rule position (which is the last one) and 'specificity'. Implementation of 'specificity' differs in each browser (and even W3C specs are different). Basically if .aw-my-class does not work by itself you should try things like

.aw-grid-control .aw-my-class {...}
#myGrid .aw-my-class {...}



Alex (ActiveWidgets)
January 4,

This topic is archived.

See also:


Back to support forum