Multiple selection in column filtering
Multiple selection in column filtering
SimonSebright
Posts: 2Questions: 1Answers: 0
Hi, I am looking to replace the column filtering dropdowns with multiple selection elements (checkboxes, Select element with multiple selections allowed) to allow our user to select multiple values with OR logic (e.g. show me all projects with status green or red). Is this possible with the DataTables library? Thanks in advance, Simon
This discussion has been closed.
Answers
Hi Simon, this is indeed possible. For each column you can set an indiviual search filter as you can see in the following example:
https://datatables.net/examples/api/multi_filter.html
The filter value itself uses the OR logic already. Every value separated by a space is seen as a separate value. So in your solution you just need to set the column search value depending on the selection.
you can try my yadcf plugin for datatables, it suppport select2 / chosen / any otherselect plugin and it support multi select as well, see showcase page (notice forst column filter) http://yadcf-showcase.appspot.com/DOM_source_select2.html
Hi theWizard, thanks, but I am not sure that I expressed myself correctly. The example you quote does not appear to have OR logic. For example, if I type "cara ashton" into the name search box, I get nothing. In my example, we have dropdowns for the available values in columns and want to multi-select these. For example, imagine a list of projects. Each has a status, which might be green, red or yellow. I want to have the UI allow me to select all projects with either green or yellow, for example. Thanks and regards, Simon