Filtering table using many input filter simultanously

Filtering table using many input filter simultanously

fanfefanfe Posts: 8Questions: 3Answers: 0
edited April 2019 in Free community support


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:

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    Answer ✓

    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 use table.draw() to run the plugin. The plugin can then check each column and if there is a match return true.

    Kevin

  • fanfefanfe Posts: 8Questions: 3Answers: 0

    Thanks very much, it works perfectly.
    Please now, how to reset the search results to make the datatable restore is initial state

  • colincolin Posts: 15,143Questions: 1Answers: 2,586
    edited April 2019 Answer ✓

    Hi @fanfe ,

    You just need to clear the input elements, such as $('#example_filter input').val('');,

    Cheers,

    Colin

  • fanfefanfe Posts: 8Questions: 3Answers: 0

    Hello colin, yes i clearedthe input and apply a table.draw() on the datatble.
    Thanks for the support

  • fanfefanfe Posts: 8Questions: 3Answers: 0

    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

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    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

This discussion has been closed.