Defined searches called by custom DT buttons
Defined searches called by custom DT buttons
cj1005
Posts: 143Questions: 46Answers: 1
Hi, I have a data table of sale orders and currently, users have to use the 'Search Builder' to filter the data, but the majority of the searches are common, so I'd like to have buttons at the top of the data table that performs these common searches when clicked, is this possible?
I can see there is a pre-defined option for the search builder, but I cannot see how this would be replicable to a custom button.
Thanks, Chris
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Yep, this example here shows how you can load queries. You could add that API call (
searchBuilder.rebuild()
) into your button'saction
function,Colin
Thank you Colin, I'll have a play
Hi Colin,
I've added the code as described, but I'm getting the following error:
"dataTables.searchBuilder.min.js:151 Uncaught TypeError: Cannot read property '_searchBuilder' of undefined"
I've created 3 buttons, which all result in the same error as above.
The code I've added is as follows:
Any ideas?
Cheers, Chris
Verify that your
table
id isvehiclesTable
. If you still need help please provide a link to your page or a test case replicating the issue so we can help debug.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thank you, Kevin, you were right, I was using the variable reference of the table not the actual table name