Basically I want to set row color based on a flag in an array, but would still like built-in features like row selection colors to work. I've done something similar to the following but it breaks selected row highlighting. There is one entry in the matchFlag array for each data row in the table (data including match flag is all generated in PHP)
My code is based on this example
http://www.activewidgets.com/javascript.forum.12018.3/alternative-row-color-depend-of.html
var matchFlag [ 0, 1, 0, 0, 0 ];
var obj = new AW.UI.Grid;
obj.setSize(725, 300);
obj.setCellText(columnData);
obj.setHeaderText(columnHeaders);
obj.setColumnCount(12);
obj.setRowCount(
obj.setSelectionMode("single-row");
obj.defineRowProperty("color", function(row){
var color = "white";
if(matchFlag[row] == 1) {
color ="red";
} else if(row % 2 == 0) {
color = "#f2f4ff";
} else if(this.getRowSelected(row)) {
color = "blue";
}
return color;
})
obj.getRowTemplate().setStyle("background", function(){
return this.getRowProperty("color");
});
document.write(obj);
I should add that row selection highlighting is broken with or without the code involving the selected row, I've tried it both ways.
Nevermind, I figured out a MUCH easier way to do this by generating the style information in php.
This topic is archived.