:: Forum >>

Sorting affects background color

Hello ,
Could you please help me on this program. I do alternate backgrond color + depending on column 18 , the background color will be different.
Now the sorting creates the problem. The color ffffa0 remains on the same row even after sorting.

var alternate = function(){
var rwn = this.getProperty("row/order");
var color = rwn % 2 ? "#fcfaf6" : "#ffffff";
var colorVal = myData[rwn][18];
return (colorVal=='1') ? "ffffa0" : color;
}
var row = new Active.Templates.Row;
row.setStyle("background", alternate);

Thanks
Hari
Hari
Thursday, April 28, 2005
The following is a snipped from some code I use with alternate row colors.
Comparing that with your code it looks like you are missing the last statement: obj.setTemplate("row", row);

var row = new Active.Templates.Row;
var alternate = function(){
return this.getProperty("row/order") % 2 ? gridInfo.getRowEvenColor() : gridInfo.getRowOddColor();
}

row.setStyle("background", alternate);
obj.setTemplate("row", row);
Andreas
Thursday, April 28, 2005
Hi Andreas,
Actually I have that code too and it is displaying with background colors. I have 3 background colors. Two as alternate colors (say white and gray) and one (yellow) if there is a error in column 18 . So it works fine until you sort. After sorting the error row with yellow background stays static. I need to code , when sorting the error background refreshes.
Could you please help on this coding.
As you see in the code , I check on column 18 and depending on that , the background is set.

var alternate = function(){
var rwn = this.getProperty("row/order");
var color = rwn % 2 ? "#fcfaf6" : "#ffffff";
var colorVal = myData[rwn][18];
return (colorVal=='1') ? "ffffa0" : color;
}
var row = new Active.Templates.Row;
row.setStyle("background", alternate);
row.setEvent("onmouseover", "mouseover(this, 'active-row-highlight')");
row.setEvent("onmouseout", "mouseout(this, 'active-row-highlight')");
obj.setTemplate("row", row);

Thanks
Hari
Hari
Saturday, April 30, 2005
Hello,
Is the above code is OK?
Thanks
Hari
Hari
Thursday, May 5, 2005
Sorting will change a row's "row/order" property.

So instead of this:

var rwn = this.getProperty("row/order");

try this:

var rwn = this.getProperty("row/index");
CK
Tuesday, June 7, 2005

This topic is archived.


Back to support forum

Forum search