MultiSelect - showToggleAll not working as expected #16039
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When using MultiSelect, we have a use case where we need to pass the
selectionLimit
prop conditionally. Like this:This is the most recommended way to pass props conditionally.
So, in the MultiSelect component, you have a method to show/hide the Toggle All checkbox. The problem comes in this line where you are transforming the selectionLimit variable. When passing null or undefined, this transform is transforming the variable to
NaN
, so later yourisSelectionAllDisabled
method is not working as expected becauseObjectUtils.isEmpty(NaN)
is false.At the end, when passing null or undefined to the
selectionLimit
prop, we end up not showing the Toggle All checkbox at all.Do you have a workaround? Or other recommended way?
Thanks a lot
Last note:
Angular people told me that this is the expected behaviour for the numberAttribute transform
Environment
Reproducer
https://stackblitz.com/edit/pi4qot?file=src%2Fapp%2Fmulti-select-basic-demo.html
Angular version
18.1.0
PrimeNG version
17.18.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v22.4.1
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
I should see the Toggle All checkbox when passing null or undefined to the
selectionLimit
propThe text was updated successfully, but these errors were encountered: