Datatables: Change cell color based on values
First of all, initialize DataTable only once. Then as per your question, use rowCallback and not fnRowCallBack as shown below: var oTable = $(‘#countryTable’).DataTable({ ‘rowCallback’: function(row, data, index){ if(data[3]> 11.7){ $(row).find(‘td:eq(3)’).css(‘color’, ‘red’); } if(data[2].toUpperCase() == ‘EE’){ $(row).find(‘td:eq(2)’).css(‘color’, ‘blue’); } } }); Here’s a fiddle