DataTables Custom Buttton and Column Searching
DataTables Custom Buttton and Column Searching
I have a databtable with 15 columns and I am using server side processing because the table has 400K rows.
I have 4 columns in this datatable that have input boxes in the footer for user filtering.
I do not want to filter on Key Up event, instead i have added a custom button called filter.
The desired behavior would be for the user to type in filtering data to multiple columns and then filter the data all at once by clicking the new button.
Any idea how i could do this? Is there an example I can look at that performs more customized searching?
This question has an accepted answers - jump to answer
Answers
You can use the
search()
orcolumn().search()
in a button click event. I built a simplified version (no inputs) to demonstrate:http://live.datatables.net/zeliyido/1/edit
Note that the click event performs two column searches but uses draw only once. You can look at the XHR request Headers in the Developer Tools > Network tool and see the request has the search term for both columns:
The server side script used appears to use an AND for the SQL Query. Depending on your solution requirements you may need to use an OR search query.
Kevin
Thank you.