I have this datatable That I want to have different row color for each row, I am using the following code but the class is never added
var oTableNE = $('#tabelNE').dataTable({
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
// Bold the grade for all 'A' grade browsers
if ( aData[8] == "Submitted" )
{
$('tr', nRow).addClass("submittedColor");
console.log("Change Color by adding CSS Class" + " nRow " +nRow + " " +aData[0] + " | " +aData[1] + " | " +aData[2]+ " | " +aData[8]);
}else{
console.log("Don't Change Color" + " nRow " +nRow + " " +aData[0] + " | " +aData[1] + " | " +aData[2]+ " | " +aData[8]);
}
}
});
Not sure what your are getting as nRow, if its the index of the row do as above. If its the row element itself do as below.