3.0.0

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
April 28,
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
April 28,
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
April 30,
Hello,
Is the above code is OK?
Thanks
Hari
Hari
May 5,
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
June 7,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.