3.2.0

Overwriting css's items

Hi,

I am trying to change the color of a row on the basis of value in Column 1 of each row. The issue is that this implementation overwrites the row color as set by the css (alternate row color). For the rows where (text == 'MSFT 2') as shown in code below, the green color is fine but for the other rows, the row color as set by css is gone.
Is there a way to rectify this implementation to avaoid the overwriting of css row color ?

#myGrid_div_grid1 .aw-alternate-even {color:#000000;background:#F2F5F7;}
#myGrid_div_grid1 .aw-alternate-odd {color:#000000;background:#FFFFFF;}

function totalRowColor()
{
// add new row property for background color
gridObj.defineRowProperty("myprop", function(row){

// lets say we check the text from the column 1
var text = this.getCellText(0, row); //column, row

var cellColor='';
if (text == 'MSFT 2') {
cellColor = "green";
}
return cellColor;
});


// assign rowBackground to row template style
gridObj.getRowTemplate().setStyle("background", function(){ return this.getRowProperty("myprop")});

}
cpuri
July 13,
You can use setClass() instead of setStyle() and assign specific colors via CSS.
Alex (ActiveWidgets)
July 15,
The issue here is that as soon as I do:
gridObj.getRowTemplate().setStyle

It gets applicable to all rows in the grid. setClass would do no different.
Is there a way to apply the background color on specific rows only and not touching the background color of other rows ?

Also is it possible to assign a css class equal to existing class. The reason for me asking this question is that we already have existing css classes but since we have to incorporate the aw grid we have to redefine the attributes to css classes used by aw grid.
Ex: #myGrid_div_grid1 .aw-alternate-even {color:#000000;background:#F2F5F7;}
Now I already have a class which has the attributes {color:#000000;background:#F2F5F7;}
Can we do something like #myGrid_div_grid1 .aw-alternate-even {mycssclassname} ?
cpuri
July 16,

This topic is archived.

See also:


Back to support forum