Change column color based on header value
I have the following code to change the row colors based on a cell value:
var levelColors=[null,'yellow','#99CCFF','#99CC00'];
grid.defineRowProperty("rowcolor", function(row){
return levelColors[this.getCellValue(0, row)];
});
grid.getRowTemplate().setStyle("background-color", function(){
return this.getRowProperty("rowcolor");
});
I'd also like to change the column's background color based on a value (this time the header for that column). I've tried doing something like:
grid.defineColumnProperty("colcolor", function(col) {
return "blue";
});
grid.getColumnTemplate().setStyle("background-color", function() {
return this.getColumnProperty("colcolor");
});
Thanks!
var levelColors=[null,'yellow','#99CCFF','#99CC00'];
grid.defineRowProperty("rowcolor", function(row){
return levelColors[this.getCellValue(0, row)];
});
grid.getRowTemplate().setStyle("background-color", function(){
return this.getRowProperty("rowcolor");
});
I'd also like to change the column's background color based on a value (this time the header for that column). I've tried doing something like:
grid.defineColumnProperty("colcolor", function(col) {
return "blue";
});
grid.getColumnTemplate().setStyle("background-color", function() {
return this.getColumnProperty("colcolor");
});
Thanks!
Laura
February 4,