OR-Search
OR-Search
I would like to search for several items that are provided in an array. If one of the item is present in the column identified by the index, the row should be shown. This means it should be an OR search. Currently I am using join(' ')
, which output no results, because its interpreted as AND search. How can I make an OR search? Some items contains spaces, consists of several words...
The search by the user (input field), should work normally, as provided by DataTables, but additonally to the search explained above.
Here is an example: https://jsfiddle.net/erik_stengel/bhogtnxs/#&togetherjs=vFMhwEPgUc
Answers
Use a regex search and join the strings using the
|
OR regex token. Like this:https://jsfiddle.net/kjw5ygmh/
See the
search()
docs for more details. Also see this example.Kevin