B4 Bug when coloring a row based on a value in a cell
I have the following code to coloring a row based on a value in a cell:
// add new cell properties for foreground/background colors
obj.defineCellProperty("background-color", function(column, row){
//alert('row = ' + row);
var text = this.getCellText(column, row);
var cellColor;
if (text < 200) {
cellColor = "#00FF00";
}
if (text > 450) {
cellColor = "red";
}
if (text >= 200){
if (text <=450){
cellColor = "yellow";
}
}
//alert('setStyle row = ' + row);
obj.getRowTemplate(row).setStyle("background-color", cellColor); // this should work
return cellColor;
});
// assign background-color property to column-1 background
obj.getCellTemplate(2).setStyle("background-color", function(){
return this.getControlProperty("background-color");
});
In B3 it would not show the color for the row until the grid was redrawn either by moving the scrollbar or by sorting. In B4 the color shows but for other than the cell property the row color is off by 1 (higher) and row 0 is not colored at all.
// add new cell properties for foreground/background colors
obj.defineCellProperty("background-color", function(column, row){
//alert('row = ' + row);
var text = this.getCellText(column, row);
var cellColor;
if (text < 200) {
cellColor = "#00FF00";
}
if (text > 450) {
cellColor = "red";
}
if (text >= 200){
if (text <=450){
cellColor = "yellow";
}
}
//alert('setStyle row = ' + row);
obj.getRowTemplate(row).setStyle("background-color", cellColor); // this should work
return cellColor;
});
// assign background-color property to column-1 background
obj.getCellTemplate(2).setStyle("background-color", function(){
return this.getControlProperty("background-color");
});
In B3 it would not show the color for the row until the grid was redrawn either by moving the scrollbar or by sorting. In B4 the color shows but for other than the cell property the row color is off by 1 (higher) and row 0 is not colored at all.
ShepherdOwner
January 23,