3.2.0

Text color based on number value

Hello

I am hoping to make negative numbers automatically go red. I looked though the forum and couldnt see an obvious solution.

Thanks a lot for your help.
Greg
February 23,

Look at the function below, it sets color to blue if over 89 and red if below.
Should be re-usable for you with small adaptation.

function myColor(){ 
    var i = this.getItemProperty("value"); 
    return i > 89 ? "blue" : "red"; 
    } 

  obj.getColumnTemplate(6).setStyle("color", myColor);
dragonmood
February 25,
yes, you can look in examples/grid/cell colors.htm for the similar code.
Alex (ActiveWidgets)
February 25,
thanks alot
Greg
March 1,

This topic is archived.

See also:


Back to support forum