Changing the search filter to an additive search?

Changing the search filter to an additive search?

arlyonarlyon Posts: 2Questions: 1Answers: 0

I am trying to set up a semantic ui multiple select to filter the table. I have managed to get it to work, however the search is subtractive (more keywords equals fewer results) instead of additive (returning the content of both keywords).

The multiple select returns a list of the currently selected keywords ex ["Cancelled", "Success"], and I would like to filter by both elements individually and merge the result if that makes sense, instead of filter by both and return those that match all the inputs.

Thanks!

Answers

  • arlyonarlyon Posts: 2Questions: 1Answers: 0

    Looks like you can put regexes right into the search box.

    ex table.search("^(?=.?("+regex+")).?").draw() ;

    Might be an idea to write this on the docs page here:

    https://datatables.net/examples/api/regex.html

  • allanallan Posts: 64,756Questions: 1Answers: 10,716 Site admin

    Hi,

    Thanks for posting back. You are correct - that's how to go about it. Another option is to use a custom plug-in filter (although you are obviously conformable with regex!).

    Allan

This discussion has been closed.