primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.21k stars 4.55k forks source link

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

Open sotjdisc opened 6 months ago

sotjdisc commented 6 months ago

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.

dobanisola-scottlogic commented 4 months ago

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

github-actions[bot] commented 4 weeks ago

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!

sotjdisc commented 4 weeks ago

Still persists