Reset full search
Reset full search
sairus95
Posts: 5Questions: 2Answers: 0
hello, I created a button outside the table to erase all searches, it works but very long around 6s. Do you have a solution to optimize thank you
dom: "<'row'<'col-lg-4 col-sm-12'l><'col-lg-2 col-sm-12 d-flex justify-content-center reset'><'col-lg-2 col-sm-12 d-flex justify-content-center resetReorderCol'><'col-lg-4 col-sm-12'f>>"+"<'row'<'col-lg-12 col-sm-12'tr>>"+"<'row'<'col-lg-4 col-sm-12'B><'col-lg-4 col-sm-12 d-flex justify-content-center'i><'col-lg-4 col-sm-12 d-flex justify-content-center'p>>",
$('#tableTool_wrapper button.btn.btn-danger.clearSearch').click(function() {
$('#tableTool_filter input').focus().select().val('');
table
.search('')
.draw();
});
Answers
You can drop line 4, and just use
search()
as that'll clear theinput
element as well.If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Here is my table
live.datatables.net/detebupo/1/
Colin was asking for a link to a running test case to debug why it takes 6 seconds to reset the search. the problem might be due to the amount of data or something else occurring on your page.
Kevin
Your example doesn't run. You don't appear to have included jQuery.
I included jquery
there are 700 rows and 23 columns in the table
the longest is the deletion in the selects
The include statements are in the wrong order because you are getting this error:
The code you posted above is only clearing the global search, not including the select column searches. You are using the YADCF column search library. How are you clearing those? For issues specific to YADCF please contact the developer of the library.
Again for help please provide a running test case that shows the issue with steps of how to recreate the issue.
Kevin