Filtering table using many input filter simultanously
Filtering table using many input filter simultanously
fanfe
Posts: 8Questions: 3Answers: 0
Hello, i have a datatable with 5 inputs filter field, each one corresponding to a column.
I want to be able to enter in each field, some filtering values and onclick of a button, the table is filtered simultaneously according to all the tables filter fields.
Please help, have to do it urgently
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I would create a search plugin for this. The Range Search example will give you an idea of what to do. In the example there is a
keyup
event for the inputs. In your case you would have a click event for the button then usetable.draw()
to run the plugin. The plugin can then check each column and if there is a matchreturn true
.Kevin
Thanks very much, it works perfectly.
Please now, how to reset the search results to make the datatable restore is initial state
Hi @fanfe ,
You just need to clear the input elements, such as
$('#example_filter input').val('');
,Cheers,
Colin
Hello colin, yes i clearedthe input and apply a table.draw() on the datatble.
Thanks for the support
Hello, before anything, thanks a lot for the help you people are providing me.
I have last issue to close this my challenge.
I want the research to be made in the entire datable even when i have pagination activated in the datatable.
Actually, it's searching only on the first page.
Regards
Hi @fanfe ,
Searching is always over the entire table, not an individual page. 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