Skip to content
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

Open
sotjdisc opened this issue Mar 11, 2024 · 5 comments
Open

Table: Global filter match mode NOT_CONTAINS does not work #15009

sotjdisc opened this issue Mar 11, 2024 · 5 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@sotjdisc
Copy link

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.

@sotjdisc sotjdisc added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 11, 2024
@mehmetcetin01140 mehmetcetin01140 added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 18, 2024
@dobanisola-scottlogic
Copy link
Contributor

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’]’.

Copy link

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!

@github-actions github-actions bot added the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label Aug 23, 2024
@sotjdisc
Copy link
Author

Still persists

@github-actions github-actions bot removed the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label Aug 24, 2024
@juri-sinitson
Copy link

juri-sinitson commented Nov 18, 2024

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?

juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
Additionally move the filter method there
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
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
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
- Especially the fixing the global filter `notContains`
which is the main scope of this issue.
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Nov 26, 2024
@juri-sinitson
Copy link

This PR fixes the issue

juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
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
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
- Especially the fixing the global filter `notContains`
which is the main scope of this issue.
- Improve signature
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
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
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
- Especially the fixing the global filter `notContains`
which is the main scope of this issue.
- Improve signature
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
juri-sinitson added a commit to juri-sinitson/primeng that referenced this issue Dec 20, 2024
@mertsincan mertsincan added this to the Future milestone Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Review
Development

No branches or pull requests

5 participants