Update aaData with keeping Sorting and Searching, without destroying + re-creating... How?
Update aaData with keeping Sorting and Searching, without destroying + re-creating... How?
Greetings!
I'm using ajax's jQuery's $.get() - to fetch aaData and Header of a table.
Thereafter, simple creating of a table by such way:
var j = JSON.parse( data );
$('#dt_name').dataTable( {
"aaData": j['method']['aaData'],
"aoColumns": j['method']['header'],
} );
Everything fine.
Now, I'm looking for a neat way to update aaData of a table without full and complete reloading of a page or even div tag.
Is there?
For example, I can see very dirty way
to brute all of aaData of a table and row by row compare it with Updates.
If any changes,
then
replace by cell() method aaData in table.
go_to next cell...
Is it correct way?
I'm asking, because methinks that it is too ugly and hard for resources of a client-browser way.
For example, such method like:
dataTable.updateaaData( newaaData ); // shall replace every new datas and keep sorting + searching. Howevery, I can't find one.
Cheers!
Answers
Solved.
I've used such construction:
That's the way to do it :-). Or using the modern API rather than the legacy one, use
clear()
androws.add()
.Allan