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

FilterService: match modes "equals" and "not equals" do not work with numeric filter on fractional values #14978

Closed
lephyrus opened this issue Mar 7, 2024 · 0 comments · Fixed by #15351
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@lephyrus
Copy link

lephyrus commented Mar 7, 2024

Describe the bug

The use case is a table with a column that has numeric values which are formatted to have a fixed number of decimal digits, like so: 1.0, 1.5, etc.

A column filter of type "numeric" works as expected when the match modes "less than (or equal to)" or "greater than (or equal to)" are used. However, using "(not) equals" always yield zero matching rows.

The problem is that while 1 == '1.0' or 1.0 == '1.0' or 1.000 == '1.0' is all true, which is the comparison for the working match modes, the "(not) equals" match modes convert both values to strings first, in which case the result is always false.

Environment

Since there's a StackBlitz reproduction, I don't think our environment matters.

Reproducer

https://stackblitz.com/edit/9nkhvs

Angular version

17.2.4

PrimeNG version

17.9.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.10.0

Browser(s)

No response

Steps to reproduce the behavior

In the linked StackBlitz:

  1. Use the filter on the Number column with the "greater than" match mode: see that it works.
  2. Use the filter on the Number column with the "equals" match mode: see that it does NOT work.

Expected behavior

  • Using the match mode "equals" with a value of 2 should yield the row with the value 2.0.
  • Using the match mode "not equals" with a value of 2 should yield all other rows.
@lephyrus lephyrus 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 7, 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
@cetincakiroglu cetincakiroglu added this to the 17.15.0 milestone Apr 26, 2024
cetincakiroglu added a commit that referenced this issue Apr 26, 2024
Bug #14978: Table filter integer does not equal decimal string
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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants