:: Forum >>
Setting a cell to a color based on the cell value
Hi,
How can I set the color of a particular cell in a Grid to eg. red or blue
based on whether the value of the cell is eg. < 0 or >= 0 respectively??
Thanks
Bernie
Sunday, April 29, 2007
Here is an example -
var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(10);
obj.defineCellProperty("color");
obj.setCellColor(function(col, row){
var value = this.getCellValue(col, row);
if (value > 1){
return "red";
}
else {
return "white";
}
});
obj.getCellTemplate().setStyle("background", function(){
return this.getCellProperty("color");
});
document.write(obj);
Alex (ActiveWidgets)
Monday, April 30, 2007
This topic is archived.
Back to support forum
Forum search