:: Forum >>

Style change from code


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 Nickel
Saturday, October 27, 2007

Was this a really dumb question?

Monday, October 29, 2007
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")};

Monday, October 29, 2007
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 Nickel
Monday, October 29, 2007
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.

Monday, October 29, 2007

This topic is archived.

Back to support forum

Forum search