obj.defineCellProperty("color", false)
obj.getCellTemplate().setStyle("background", function(){
return this.getCellProperty("color") ? "red" : "white";
});
obj.setCellColor(false);
obj.refresh();
var obj = new AW.UI.Grid;
obj.setCellText(function(i, j){return j + "." + i});
obj.setHeaderText(function(i){return "Col " + i});
obj.setColumnCount(20);
obj.setRowCount(100);
// create new cell property, default value = false
obj.defineCellProperty("color", false)
// link cell background to cell color property
obj.getCellTemplate().setStyle("background", function(){
return this.getCellProperty("color") ? "red" : "white";
});
// mark some cells
for (var r=0; r<obj.getRowCount(); r++){
for (var c=0; c<obj.getColumnCount(); c++){
if (obj.getCellText(c, r).match("1")){
obj.setCellColor(true, c, r);
}
}
}
document.write(obj);
var button = new AW.UI.Button;
button.setControlText("reset");
document.write(button);
button.onClick = function(){
obj.setCellColor(false);
obj.refresh();
}
This topic is archived.