ajax.data not being sent to the server with every request
ajax.data not being sent to the server with every request
Hi and thanks for this great plugin!
We've been using DataTables in a way that might not have been intended. Instead of using DataTables search box, we have an advanced search in place. The search is done on the server side, passing a json string as ajax.data
option (as per: https://datatables.net/reference/option/ajax.data):
data: function(d) {
d.jsonQueryString = Run.jsonQueryString;
}
That string is passed to the server as an added parameter to all the parameters sent by DataTables, the results returned from the database and the DataTable correctly drawn.
But the json string is not passed to the server when doing pagination or sorting. So basically, the search returns a completely different set of results when clicking on the next page or trying to sort a column.
Is there any way to tell DataTables to use the data parameter with every request?
Let me know if you need more details, thanks a lot,
Marta
This question has an accepted answers - jump to answer
Answers
In fact, it seems that the jsonQueryString IS present in the parameter list sent to the server but it's set to "". So it might be my doing. Please disregard the question for now.
Yes, definitely my doing. It was being reset somewhere in the code, not to collide with the default DataTables search box (while we still had it). Please disregard, works fine.
Thanks for the updates - good to hear you've got it working!
Allan
Thanks again for such a great plugin!