问题
multi_select filter with select2 in yadcf (datatables plugin) has a ambiguous solution for filtering. If you have inside rows single values like
value1
value2
when you filtering you have a OR
filtering. It shows all rows with values1 and values2.
If you set a text delimiter like a comma or multiple delimiters (using regex) multiple_select filter behaves as a AND
condition.
Look an example for column 0: Example
Is possible to have a javascript function that enables or an AND condition or an OR condition according to suit your needs?
For better exposure I made a little video of what the problem is and what I expect to see in the table.
Problem is tricky but It should not be difficult to solve with right javascript code
VIDEO
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Adding feature improvement request:
New VIDEO
Example used in video: Table
回答1:
The purpose of the text delimiter is to help you extract values from your column into the filter, but... when you try to pick up a value from the filter and apply it to the table, you will get all the rows that your selected value is located in.
In case that you want so advanced logic to be executed when you pick up a value you should then use the filter_type: 'custom_func'
or multi_select_custom_func
see how it works on the showcase (its the first column) scroll down to the see the code used on that page.
Finally I understood your problem, while the multi select should always work as OR filter on the selected values it wasn't doing so, I have fixed it in the latest beta 0.8.8.beta.11 and here is an updated jsfiddle
Regarding your AND question: You can't accomplish it with mutli select + text_data_delimiter
image that you have a column with AAA, BBB and now your user can select AAA then BBB (that should work) but he can also select BBB and then AAA, and there is no regex that can spot the BBB, AAA as AAA, BBB (and that was just a small example)
So the best solution would be to switch between filter_type: "multi_select"
with text_data_delimiter to (filter_type: "multi_select"
without text_data_delimiter or filter_type: "select"
)
And there is already a similar issue open for that (not sure when I will implement it)
来源:https://stackoverflow.com/questions/29175813/ambiguous-multi-select-filter-and-and-or-condition-javascript