Ajax option - pagination not working
Ajax option - pagination not working
shivP
Posts: 1Questions: 1Answers: 0
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
data
object. Take a look at theajax
tabs of these two examples:https://datatables.net/examples/ajax/simple.html
https://datatables.net/examples/ajax/objects.html
If
_data
is an array of objects or arrays, as described here then maybe you just need to change thecallback
to this:callback({data: _data});
Kevin