How can I highlight new loaded record after realoding datatable using ajax.reload() method?
How can I highlight new loaded record after realoding datatable using ajax.reload() method?

I can reload DataTable using ajax and timer. Now, I want to highlight the new found record on the datatable, is it posible?
window.setInterval(function(){
/// call your function here
$('#notification').DataTable().ajax.reload(function (json) {
if(json=="")
{
$('#newUpdate').append('<div style="color:red">No Updates available</div>');
//console.log ('no update');
}
else
{
'I WANT TO GET NEWLY FOUND RECORDS
' AND HIGHLIGHT THOSE NEWLY FOUND RECORDS IN DATA TABLE
}
});
}, 3000);
Thank you for your help in advance.
This discussion has been closed.
Answers
The problem with
ajax.reload()
is that it is basically a short cut for:So really every row is new since all have been deleted and then added.
What you really want is an update on the rows which are different. DataTables' API doesn't provide a method for that - you'd need to check the newly loaded data against the existing rows to find the rows which are updated, added and removed.
Allan