I know it's been asked before, but I cant get it to run and I'm out of things to try.
I want to colorize a row in a Grid if its value is not 1 - I use a custom formatter for this. The formatter itself works, that's not the problem.
I've tried multiple ways I've found so far on the web - adding a class, directly adding CSS code, using setRowData
, using setCell
....
Here are my examples - none of them worked for me (Linux, ff363) - any pointer would be greatly appreciated.
27.05.2010_00:00:00-27.05.2010_00:00:00 is my row id
<style>
.state_inactive {
background-color: red !important;
}
.state_active {
background-color: green !important;
}
</style>
function format_state (cellvalue, options, rowObject)
{
var elem='#'+options.gid;
if (cellvalue != 1) {
jQuery('#list2').setRowData(options.rowID,'',
{'background-color':'#FF6F6F'});
jQuery('#list2').setRowData('27.05.2010_00:00:00-27.05.2010_00:00:00',
'',{'background-color':'#FF6F6F'});
for (var cnt=0;cnt<rowObject.length;cnt=cnt+1) {
jQuery(elem).setCell(options.rowId,cnt,'','state_inactive','');
jQuery(elem).setCell('"'+options.rowId+'"',cnt,'','state_inactive');
jQuery(elem).setCell('"'+options.rowId+'"',cnt,'5',
{'background-color':'#FF6F6F'},'');
}
} else {
for (var cnt=0;cnt<rowObject.length;cnt=cnt+1) {
jQuery(elem).setCell(options.rowId,cnt,'','state_active','');
}
}
<!-- dont modify, we simply added the class above-->
return cellvalue;
}