Server-side processing, possible to return addition page.info() data?
Server-side processing, possible to return addition page.info() data?
I am using custom server-side processing for some tables with DataTables 1.10.15.
Is it possible to have the server supply extra information to the page.info() API?
Like how recordsFiltered
on the server translates to recordsDisplay
in page.info()
.
I maintaining a "selected" state of all the selected rows on the server and would like to return a recordsSelected
amount along with the typical server-side data that gets sent back.
e.g.
{
draw: 1,
recordsTotal: 10000,
recordsFiltered: 500,
recordsSelected: 25,
data: {}
}
I see that in fnDrawCallback
I can access the oSettings.json
to retrieve the data (oSettings.json.recordsSelected
) but I would like to make it part of the page.info()
data to be used elsewhere outside of fnDrawCallback
.
This question has an accepted answers - jump to answer
Answers
You can use
ajax.json()
to get the last JSON response at anytime you like. You can use thexhr
event to retrieve the JSON response once its received.Kevin
Excellent, thank you, that does exactly what I am looking for! Wow, I overlooked that, right at the top of the API docs too.