-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Table: Global filter match mode NOT_CONTAINS does not work #15009
Comments
I am uncertain whether this qualifies as a bug. So the logic is that it runs the filter logic on the fields in the 'globalFilterFields' arrays and returns all the row that returned at least one true. In the provided example, the ‘globalFilterFields’ attribute is set to [‘name’, ‘country.name’, ‘representative.name’, ‘status’] with the ‘notContains’ match mode. The expectation is that the first row should be filtered out because it contains the name ‘James’ in the name field. However, due to the logic searching against other fields and returning ‘true’, the row is still included. To achieve the desired behavior, consider narrowing the ‘globalFilterFields’ to only include the ‘name’ field, as follows: [globalFilterFields]=‘[‘name’]’. |
This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Still persists |
Yes, it definitely persists and is definitely a bug, see here I've tested this branch, it should be the most recent one. For me it looks like concatenating the match for each field with the and-operator would solve the problem. Maybe it's reasonable to put the filtering stuff to the TableService and introduce unit testing for it beginning with the filtering. I think the 'notContains' used globally would be a good candidate for first tests. I think it's doable for me to fix that bug during this week including the unit tests for global notContains operator. Does it make sense for you @cetincakiroglu and @cagataycivici? |
Additionally move the filter method there
NOTE: 1. Configured jest according to https://thymikee.github.io/jest-preset-angular/docs/getting-started/installation 2. In was recommended in diverse sources to comment out the files in `tsconfig.spec.json` to avoid conflicts with jest
- To debug in the browser
- Especially the fixing the global filter `notContains` which is the main scope of this issue.
This PR fixes the issue |
NOTE: 1. Configured jest according to https://thymikee.github.io/jest-preset-angular/docs/getting-started/installation 2. In was recommended in diverse sources to comment out the files in `tsconfig.spec.json` to avoid conflicts with jest
- To debug in the browser
- Especially the fixing the global filter `notContains` which is the main scope of this issue. - Improve signature
NOTE: 1. Configured jest according to https://thymikee.github.io/jest-preset-angular/docs/getting-started/installation 2. In was recommended in diverse sources to comment out the files in `tsconfig.spec.json` to avoid conflicts with jest
- To debug in the browser
- Especially the fixing the global filter `notContains` which is the main scope of this issue. - Improve signature
Describe the bug
Global filtering a table with match mode 'notContains' does not work
Environment
Reproducible at stackblitz
Reproducer
https://stackblitz.com/edit/cx2ynl?file=src%2Fapp%2Fdemo%2Ftable-filter-menu-demo.html
Angular version
17.2.2
PrimeNG version
17.10.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
Stackblitz node version
Browser(s)
Chrome 122.0.6261.112
Steps to reproduce the behavior
Type on the global search box 'James'.
Expected behavior
All rows containing 'James' must be filtered out.
The text was updated successfully, but these errors were encountered: