Multiple column search with regular expression for exact match
Multiple column search with regular expression for exact match
Hi,
I'm using datatables 1.10.15, and I have an array of strings which I want to search on **two ** columns in the table.
The search has to be for an exact match.
For example, if my table consists of a "name" column and a "number" column, and I search the terms "Hell" and "1234", I want to be able to find them both (find "Hell" in the "name" column, but not "Hello", and find "1234" in the number column, but not "12345", and have a table drawn that combines both these searches)
I already combined all the array items with a pipe (|) for the regular expression, but how do I create an OR logic to combine the search results of two columns?
Thanks,
Avihai.
Replies
One option is to create a search plugin. This blog provides a detailed example.
I created an example:
http://live.datatables.net/zibixivi/1/edit
It uses an array to search in two columns. The first element in the array is for column 0 and the second for column 2.
Kevin
Thanks Kevin! I played around with that for a bit and added a "pop" method, and it's working like I wanted.