ajax.reload() is not reflected in column.data()
ajax.reload() is not reflected in column.data()

Hello,
After running ajax.reload the data displayed changes on my table but the following function is not returning the new unique values:
function testFunc () {
var table = $('#myTable').DataTable();
column.data().unique().sort().each( function ( d, j ) {
console.log(d);
} );
}
What would be the cause of this behaviour?
Answers
My guess is you are calling
testFunc ()
before the asynchronousajax.reload()
process is complete. The first parameter of theajax.reload()
is a callback function you can provide to call thetestFunc ()
after the table has been updated.If this doesn't help then please provide more details/code about your implementation. A link to your page or test case showing the issue will greatly help us understand what you are doing.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin