Can I set recordsFiltered with additional ajax request?
Can I set recordsFiltered with additional ajax request?
jwerre
Posts: 1Questions: 1Answers: 0
I can't return the 'recordsFiltered' with my ajax request. Is there a way to set the 'recordsFiltered' within dataFiler with an asynchronous ajax request or promise? Something like:
$table = $('#myTable').DataTable(
ajax: {
url: url,
dataFilter: function(data) {
var json;
json = JSON.parse(data);
json.recordsTotal = total;
// can I return a async function or promise here?
json.recordsFiltered = $.getJSON("https://my-api/count.", query, function(total) { return total });
return JSON.stringify(json);
},
data: function(data) {...}
}
);
This discussion has been closed.