MultiSelect Component: onSelectAllChange() logic in VirtualScroll is incorrect. #15273
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
If we do not add VirtualScroll in the multiselect, onSelectAllChange logic works fine, clicking on Header Checkbox selects only the valid options even after filtering. But to improve the performance of the multiselect, if we add VirtualScroll the onSelectAllChange() logic marks all the items present in the list as checked.
Expected behaviour- it should check if filtering is applied or not, if filters are there then only visible valid options should be selected/deselected (as in the actual behavior of Multiselect without VirtualScroll in v17.11.0). Handle select and deselect both the scenarios.
Actual:
Expected:
Another bug, if we have previously selected any item from the multiselect and search any keyword using filter. Clicking on SelectAll checkbox will reset previously selected items and select only the visible ones.
Actual:
Expected: Selected Rome initially, then searched "n", on clicking selectAll now 4 items should be there (Rome, New York, London, Istanbul) instead of new 3 (New York, London, Istanbul).
Environment
Angular CLI: 17.3.3
Angular: 17.3.2
Node: 20.9.0
zone.js: 0.14.4
Typescript: 5.2.2
Package Manager: npm 10.1.0
OS: win32 x64
Reproducer
No response
Angular version
17.3.2
PrimeNG version
17.11.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.9.0
Browser(s)
No response
Steps to reproduce the behavior
Add VirtualScroll in your multiselect component, add the given onSelectAllChange() logic in the primeng demo example or you can directly reproduce this in the example demo given on the primeng website.
Expected behavior
SelectAll should only select/deselect the visible option list if filtering is applied.
The text was updated successfully, but these errors were encountered: