Filter function with conditions for multiple columns
Filter function with conditions for multiple columns
Filter function with conditions for multiple columns
For example, there are 3 columns:
cityName, visitedTimes, canceledVisitTimes
London, 2, 0
Berlin, 0, 3
Filtering conditions in multiple columns, like:
filter=if "visitedTimes" >0 and "canceledVisitTimes" = 0
filter result=London
What would be a suggested way to filter this by using single button?
Button would be implemented like here: button example.
This question has an accepted answers - jump to answer
Answers
For filters like this you will need to create a search plugin similar to this range filter example.
Kevin
That is for one column, no? Is needed to do that with 1 action (button).
The SearchBuilder would give you more flexibility.
https://datatables.net/extensions/searchbuilder/
The search plugin has access to all the row data. You can do comparisons of one or more columns.
If your search works with
column().search()
then you can usecolumn().search()
instead of the plugin. You can use a combination of both. You can search multiple columns withcolumn().search()
then when thedraw()
is executed the search plugin will run for the "range" type search.You can see this in the Range search example. Perform a range search then use the global search for additional filtering.
Kevin