:: Forum >>

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
Wednesday, February 23, 2005

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
Friday, February 25, 2005
yes, you can look in examples/grid/cell colors.htm for the similar code.
Alex (ActiveWidgets)
Friday, February 25, 2005
thanks alot
Greg
Tuesday, March 1, 2005

This topic is archived.


Back to support forum

Forum search