coloring a row (ajax data)
coloring a row (ajax data)
hi,
I am trying to color a row of the datatable but I am no jquery expert. How can i access the elements of the data table. My plan is to color rows where some values are smaller than a certain value differently.
Here is what i found in the Examples:
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( aData[2] < 1 )
{
$('td:eq(2)', nRow).css("color","grey");
}
[/code]
I am trying to color a row of the datatable but I am no jquery expert. How can i access the elements of the data table. My plan is to color rows where some values are smaller than a certain value differently.
Here is what i found in the Examples:
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( aData[2] < 1 )
{
$('td:eq(2)', nRow).css("color","grey");
}
[/code]
This discussion has been closed.
Replies
Regards,
Allan
[code]
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$('td', nRow).closest('tr').css('background', aData[6] === true ? '#eef' : '#fff');
return nRow;
}
[/code]
In my case, the row color is set either light blue or white depending on the value (true/false) of the hidden column [6]. This sets the colors for *each* row regardless of how many but for my purposes the table will hold no more than 600 elements. There is no noticeable delay on any of the end users browsers.