How to search across multiple columns?
How to search across multiple columns?
![ibokat](https://secure.gravatar.com/avatar/23c46d0120028b322453e5c6d8d69e9d/?default=https%3A%2F%2Fvanillicon.com%2F23c46d0120028b322453e5c6d8d69e9d_200.png&rating=g&size=120)
I want to search for a specific text in 2 different columns. Basically does the keyword "hamster" appear in column 1 or 6 and display the results. But I cannot figure out how that is working.
I have tried the following but it does not appear to work.
table.columns([1,6]).search("hamster").draw();
whats the right approach?
Answers
At this time that will result in a search on "hamster" on both columns 1 and 6 - an AND operation.
To do an OR search like that, you'd need to use a function (something which was introduced in the recently released 2.0.0). e.g.:
Note I've assumed the use of array based data there, change if you are using objects, and also I've used the new
search.fixed()
so the end user can still use the global search.Allan