:: Forum >>

Rowes Colored based on Data

I am trying to color rows based on data, eg if the value of a certain cell is greater than 50 make it one color, else make it the other. this is what I have

obj.alternate = function()
{
    if(obj.getDataText(this.getProperty('row/order'),0)>50)
    {
        return '#ddffff';
    }
    else
    {
        return '#ffffdd';
    }
}
obj.getTemplate('row').setStyle('background', obj.alternate);

the problem with this, is that when I sort, the colors stay where they are instead of moving with the data... help please!
Travis Harris
Wednesday, November 10, 2004
I guess you just have to change 'row/order' (which is display order) to 'row/index' (data array index).
Alex (ActiveWidgets)
Wednesday, November 10, 2004
You win the Make Travis Happy award of the day!!! If you were here, I'd have to buy you a rootbeer float!
Travis Harris
Thursday, November 11, 2004

This topic is archived.


Back to support forum

Forum search