3.2.0

Style change from code

Hi,

Just learning with ActiveWidgets....LOVE IT! Awesome job!

I am messing with the look/feel and I would like to be able to change the style from code.

I found things like this which work:
obj.getCellTemplate().setStyle("border-right", "1px solid #ccc");
obj.getRowTemplate().setStyle("border-bottom", "1px solid #ccc");


But I would also like to be able to do this in code:

#myGrid .aw-alternate-even {background: #fff;}
#myGrid .aw-alternate-odd {background: #eee;}


How do you access the .aw-alternate-even etc from code?

And is there a way to do this in code?

#myGrid .aw-mouseover-row {background: #ccc;}
#myGrid .aw-mousedown-row {background: #999;}


Thanks so much!

Jim
Jim Nickel
October 27,
Bump....

Was this a really dumb question?

Jim
October 29,
Jim,
You can also set alternate and mouse-over/out code this way:

grid.getRowTemplate().setStyle("background", function(){return this.getRowProperty("position") % 6 < 3 ? "#efe" : "#def"});
    
grid.onRowMouseOver = function(event, i){return this.getRowTemplate(i).setStyle("background", "#cbb" )};

grid.onRowMouseOut = function(event, i){return this.getRowTemplate(i).setStyle("background", i % 6 < 3 ? "#efe" : "#def")};

HTH
Carlos
October 29,
Perfect! Thanks so much Carlos!

I would like to understand how you figured this out - Am I just missing a whole bunch of documentation information somewhere?

Jim
Jim Nickel
October 29,
I just take a downloaded sample
in this case: examples/grid elements-rows/alternate colors
and then tune-fine a few lines.
I usually go sample-theory-docs direction rather than opposite. :-)
not sure if I'm right, but seems to work (at least for me & AW).
good luck.

Carlos
October 29,

This topic is archived.

See also:


Back to support forum