-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataTable: Advance Filtering Issue with multiple negation #7542
Comments
@the-pratik you misunderstand "Match Any" Vs "Match All". It may seems a little confusing but... Match Any says "Not Equal Egypt" AND "Not Contains lovenia" So that means every single row is true because Egypt does not contain Ioevnia. Match All says "Not Equal Egypt" OR "Not Contains lovenia" |
@melloware But don't you think it contradicts their standard behavior: "Match Any" typically implies an OR condition (rows match if any rule is true). "Match All" typically implies an AND condition (rows match only if all rules are true). |
@melloware And if you try with non negative filters e.g. starts with a Match All ends with a Please refer to the attached screenshots: The problem only occurs when we have negation filters like not contains, not equals they return true if it does not contains/not equals which results in adding the row into the dataset, whereas it should return false in case of negation filters so it doesn't get into the dataset. Correct me if I'm wrong. I'll have a look at the code as well to see if I'm getting it correctly. Meanwhile I request you not to close the issue! Thanks! |
Yep feel free to research I believe all PrimeTek libs uses the exact same pattern. But yes feel free to debug the code and report your results. |
It probably is related to having multiple "negation" filters |
Yes it is, there is no problem for a single rule only occurs when we have 2 rules and negation filters. |
@the-pratik were you able to debug? If not I am going to close as my original analysis of saying "two things are not something" means one of them IS something. |
Hi @melloware , didn't get the chance to check the code you may close it. If I get something then I will check again. |
Describe the bug
Issue Summary
When using the match any filter mode on the PrimeReact DataTable, applying multiple filters with not equals or not contains conditions returns rows that should have been excluded based on the filter criteria.
Steps to Reproduce
Use the PrimeReact DataTable with a dataset (example: a column named "Country").
Apply the following filters in match any mode:
Condition 1: Not equals "Egypt"
Condition 2: Not contains "lovenia"
(or any combination of not equals and not contains filters).
Observe the results: rows that should have been excluded by the applied filters are still displayed.
Expected Behavior
Rows meeting any of the not equals or not contains conditions should be excluded when using the match any filter mode.
Actual Behavior
The DataTable still displays rows that match the conditions specified in the not equals and not contains filters.
Screenshot
Here’s an example where:
Condition 1: Not equals "Egypt"
Condition 2: Not contains "lovenia"
Same goes with the negation filter for date with match mode 'Any' ->
Additional Notes
This issue might be due to an incorrect implementation of the match any filter logic when combining not equals and not contains filters.
The same applies for all datatypes in JavaScript.
Would appreciate a fix or a workaround for this issue. Let me know if more details are needed.
Reproducer
https://stackblitz.com/edit/vitejs-vite-y5nolsku?file=src%2FAdvancedDataTable.jsx
System Information
Steps to reproduce the behavior
Steps to Reproduce
Use the PrimeReact DataTable with a dataset (example: a column named "Country").
Apply the following filters in match any mode:
Condition 1: Not equals "Egypt"
Condition 2: Not contains "lovenia"
(or any combination of not equals and not contains filters).
Observe the results: rows that should have been excluded by the applied filters are still displayed.
Expected behavior
Expected Behavior
Rows meeting any of the not equals or not contains conditions should be excluded when using the match any filter mode.
Actual Behavior
The DataTable still displays rows that match the conditions specified in the not equals and not contains filters.
The text was updated successfully, but these errors were encountered: