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

p-table: columnFilter of type numeric are no longer working #15264

Closed
PaulSchult opened this issue Apr 12, 2024 · 6 comments · Fixed by #15275
Closed

p-table: columnFilter of type numeric are no longer working #15264

PaulSchult opened this issue Apr 12, 2024 · 6 comments · Fixed by #15275
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@PaulSchult
Copy link

Describe the bug

If you have a simple p-table with a p-colum-filter that is of type numeric, you are not able to use the filter feature of the given columFilter.

If you try to open the columnFilter and try to type some numbers nothing will happen. The following error will be displayed inside of the console.

image

This seems to be the result of the added input transforms. These will return "NaN" if the value is undefined, which in return breaks the following formatting logic of the input.
image

Environment

It's a simple p-table with some columns, forked from the offical primeNg table example.

Reproducer

https://stackblitz.com/edit/xaehyx?file=src%2Fapp%2Fdemo%2Ftable-filter-menu-demo.html

Angular version

17.3.1

PrimeNG version

17.13.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20

Browser(s)

No response

Steps to reproduce the behavior

  1. Create a p-table with at least one p-columnFilter of the numeric type
  2. Open the columnFilter of the numeric column
  3. Try to add a number the input for filtering
  4. Notice that it doesn't work

Expected behavior

No response

@PaulSchult PaulSchult added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 12, 2024
@BGBRWR
Copy link
Contributor

BGBRWR commented Apr 12, 2024

#15243 fixes this.

@PaulSchult
Copy link
Author

Are you sure? The PR doesn't change any transform that correlates with the max/minFractionDigits input.

@PaulSchult
Copy link
Author

PaulSchult commented Apr 12, 2024

I would probably suggest to add transform: (value: unknown) => numberAttribute(value, null) to the @Input() element for these two. This doesn't break the Intl.NumberFormat number formatting. If you like I could open a separate PR for this issue.

@BGBRWR
Copy link
Contributor

BGBRWR commented Apr 13, 2024

I ended up removing the transform for minFractionDigits and maxFractionDigits on the Table and InputNumber components. minFractionDigits will default to zero if it is undefined. maxFractionDigits will get set dynamically to the ISO 4217 currency code if it is undefined.

@PaulSchult
Copy link
Author

Thanks

@johanneszelger
Copy link
Contributor

I can confirm it does no longer work. A temp workaround is to set [minFractionDigits]="x" [maxFractionDigits]="x" to a value that works for you.

@cetincakiroglu cetincakiroglu added this to the 17.14.0 milestone Apr 18, 2024
@cetincakiroglu cetincakiroglu 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 Apr 18, 2024
cetincakiroglu added a commit that referenced this issue Apr 18, 2024
fix: #15264 use null as fallbackValue for input transform of minFractionDigits and maxFractionDigits
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
4 participants