3.2.0

Cell Highlighting Consolidation

I have the following code and I am wondering if there is a better way to accomplish the same thing.

table.defineCellProperty("bgcolor", function(col, row){ 
        if (this.getCellText(col, row).match(/Urgent/) || this.getCellText(col, row).match(/Global/))
          return "red";
        else if (this.getCellText(col, row).match(/High/))
          return "yellow";
        else
          return;  
    }); 

    table.defineCellProperty("color", function(col, row){ 
        if (this.getCellText(col, row).match(/Urgent/) || this.getCellText(col, row).match(/Global/))
          return "white";
        else
          return;
    }); 

    // assign color property to column-1 background 
    table.getCellTemplate(1).setStyle("background-color", function(){ 
        return this.getControlProperty("bgcolor"); 
    }); 

    // assign color property to column-1 background 
    table.getCellTemplate(1).setStyle("color", function(){ 
        return this.getControlProperty("color"); 
    });
Mike
June 30,

This topic is archived.

See also:


Back to support forum