Stop ajax call on column filter input click
Stop ajax call on column filter input click
greggo47
Posts: 8Questions: 4Answers: 0
I currently have a server side data table set up with filters on each column. Currently, when I click on the filter input inside any of the columns, I can see an ajax call is being made. I'd like to modify this so ajax calls are only made when the search button is clicked.
Can't seem to find any documentation on how to do this. Is this possible?
This discussion has been closed.
Answers
With server sire processing enabled all searches, even
column().search()
is to be performed by the server script. This is because the only rows at the client are the rows shown on the page so Datatables won't execute searches of only the client rows.Kevin
I'd like the
column.search()
to be executed on a button click instead of as the inputs are being filled out.Guessing you are doing something like this example. Remove the code inside
initComplete
and create a button click event handler. In the button click handler loop through the column inputs and usecolumn().search()
to apply the search for that column. Usedraw()
after the loop to send one ajax request, with all the column searches, to the server.If you need help with this please provide a test case showing what you are doing and your attempt at creating the button event handler.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
You can get a server side template test case from this page.
Kevin