:: Forum >>

Alternate row styles in version 2.0

This was the way to alternate background colors in version 1.0 using a function based on the order of the rows.

row = new Active.Templates.Row
row.setStyle("background", function() {
return this.getProperty("row/order") % 2 ? "ghostwhite" : "white"
})


Is there a way to achieve the same functionality in version 2.0 without having to resort to long css sections like in the examples?

This is what I'm using for the row template.

objGrid = new AW.UI.Grid
objGrid.getRowTemplate().setStyle("background", function() {
return this.getProperty("row/order") % 2 ? "ghostwhite" : "white"
})


But I get a JavaScript error on the line that begins with return. Object does not accept this property or method.

Apparently this.getProperty("row/order") is no longer valid in version 2.0.

Does anyone know the equivalent for 2.0?

And as long as we are on the subject, is there any documentation regarding the property constants available? e.g. row/order, etc

Thanks in advance.
Mario
Friday, February 3, 2006
Well first question's easy so:
Use

.aw-alternate-even {background: #39C0CF ;}
.aw-alternate-odd {background: #9CF9F9;}
or some something with your color choice

But just the other day Alex showed us how to do 'triplets'
So now your application can look just like Quicken... :-)
This is a wonderfully clever script... and use.

see:
http://www.activewidgets.com/javascript.forum.11117.4/odd-even-vs-triplets.html
G. Cayman
Friday, February 3, 2006

This topic is archived.


Back to support forum

Forum search