search() for all matches to either one of two values?
search() for all matches to either one of two values?
bricoll
Posts: 3Questions: 1Answers: 0
Is there a way to use search() to return all matches for either of two (or more) values?
Example: Return all rows matching either "knowledge" or "processes"?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
One option is to use regex searching as in this example:
https://datatables.net/examples/api/regex.html
If you choose regex and type
tokyo|london
it will show rows with both tokyo and london.Kevin
Is there a way to use that regex parameter as part of a function like the one below? (The function is invoked onclick of a dropdown menu item.) Reference manual doesn't provide quite enough info on search() for me to see precisely how the parameters work.
You can enable regex during initialization:
https://datatables.net/reference/option/search.regex
Or through the API:
https://datatables.net/reference/api/search()
Kevin
Thank you so much, Kevin!
This worked: