Ajax option - pagination not working
Ajax option - pagination not working
Hi,
I have used ajax options method to get the data as below,
$('#example').dataTable( {
"ajax": function (data, callback, settings) {
dataSourceFunction(data).then(function (_data) {
console.info(_data);
callback(_data);
});
}
} );
Here the pagination is not working, the data is fetching from the DB but the table is not getting update
This discussion has been closed.
Answers
What is
_data(array or objects, arrays)?By default Datatables expects the data to be in a
dataobject. Take a look at theajaxtabs of these two examples:https://datatables.net/examples/ajax/simple.html
https://datatables.net/examples/ajax/objects.html
If
_datais an array of objects or arrays, as described here then maybe you just need to change thecallbackto this:callback({data: _data});Kevin