Row Color Based on Row Data Without Overriding Other Styles
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
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(// number of rows from data model);
obj.setSelectionMode("single-row");
// create new row property
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;
})
// link row background to row color property
obj.getRowTemplate().setStyle("background", function(){
return this.getRowProperty("color");
});
document.write(obj);
Steve
August 15,