It depends on how the five rows are selected. You can define the fnRowCallback function to do something with your row. For example, if you want to set the background-color for rows with a value of 5 in the second column to red, you would use the following code:
It is also worth noting that Server-size processing allows you to set a row-level classname (as well as row-level id), so your back-end server can select which rows should be marked.
Using this mechanism and some css you can have selected rows highlighted. In the example on this link, rows are colored differently to indicate the 'CSS Grade' column (sort by platform to get a good mix of different grades on the first page).
the "grade" classes are specified in http://datatables.net/release-datatables/media/css/demo_table.css (it's worth noting that each grade in this example has a slightly different color depending on if it is an even or odd row)
[code]
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables row classes
*/
table.display tr.odd.gradeA {
background-color: #ddffdd;
}
Replies
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if (aData[1] == 5) {
$('td', nRow).css('background-color', 'red');
}
}
[/code]
http://datatables.net/release-datatables/examples/server_side/ids.html
Using this mechanism and some css you can have selected rows highlighted. In the example on this link, rows are colored differently to indicate the 'CSS Grade' column (sort by platform to get a good mix of different grades on the first page).
the "grade" classes are specified in http://datatables.net/release-datatables/media/css/demo_table.css (it's worth noting that each grade in this example has a slightly different color depending on if it is an even or odd row)
[code]
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables row classes
*/
table.display tr.odd.gradeA {
background-color: #ddffdd;
}
table.display tr.even.gradeA {
background-color: #eeffee;
}
table.display tr.odd.gradeC {
background-color: #ddddff;
}
table.display tr.even.gradeC {
background-color: #eeeeff;
}
table.display tr.odd.gradeX {
background-color: #ffdddd;
}
table.display tr.even.gradeX {
background-color: #ffeeee;
}
table.display tr.odd.gradeU {
background-color: #ddd;
}
table.display tr.even.gradeU {
background-color: #eee;
}[/code]