POST also forces a new GET after the changes GET?
POST also forces a new GET after the changes GET?
I have an HTML with Datatables and Datables Editor in it.
The Editor is set to POST URL /ajax/endpoint/{id} and that works.
On the backedn the update takes place and then the object changed is returned as
{data:[{ .... }]}
Datatables runs a GET to /ajax/endpoint/
The backend checks if the request is GET or POST and responds with the result of a database select or the result of the change (in the case of edit).
When testing, after the POST the response gets generated, with the change executed (as per documentation server/client).
Just after that a new GET gets generated to the /ajax/endpoint/ which I assume is done by the Datatable component.
Is this the normal behavior, and if so what is the first return for?
Backend is Python thus looking at docs here: https://editor.datatables.net/manual/server#Server-to-client
This question has an accepted answers - jump to answer
Answers
Sounds like you are using
draw()orajax.reload()in an event that occurs after the Editor update response. Using one of these APIs will cause the additional GET request from Datatables. As an example look at lines 94-112 of this example. It has events usingajax.reload(). Look for something like this in your code.If you still need help please post your relevant Editor and Datatables code. Better would be a link to your page or running test case showing the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I don't have those
APIas far as I can tell.I believe the cause is the
serverSidesetting?Yes, I believe you are correct. After the Editor updates the table Datatables wants to refresh the table to update sorting, searching, etc. This causes Datatables to fetch the page data from the server.
Kevin