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-multiselect: onChange event is not triggered for multiselect's filter select all/unselect all #14603

Closed
rosenthalj opened this issue Jan 22, 2024 · 3 comments · Fixed by #14826
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rosenthalj
Copy link
Contributor

Describe the bug

When clicking the multiselect filter's select all (or unselect all) checkbox, the onChange event is not triggered. This worked in PrimeNG 15. This issue also brakes the table filter-menu demo when filtering the "agent" column using the multiselect filter.

The first video demonstrates this issue breaks the PrimeNG v17.x filter row demo
https://primeng.org/table#filter-row (Note: https://primeng.org/table#filter-menu is similarly broke)
Clicking the column filter's selectall/unselectall checkbox has no effect on the filter

multiselectVideo1Bad.mov

The second video demonstrates the PrimeNG v15 filter row demo working correctly
https://www.primefaces.org/primeng-v15-lts/table#filter-row

multiselectVideo2v15Good.mov

I created a reproducer to isolate the issue

The third video demonstrates that the onChange events are only triggered when the multiselect's individual filter checkboxes are clicked. The multiselect's onChange events are not sent when clicking the selectall/unselectall checkbox . The reproducer consists of a multiselect with filter and two output lists. The top output list displays the selected values stored in the multiselect's model. The bottom output list displays the selected values that are created by a listener to the multiselect's onChange events. In this video, if the multiselect was properly geenrating onChange events then both the top and bottom output lists would be the same regardless of what checkboxes were clicked.

multiselectVideo3Bad.mov

I compared the v15 and v17 multiselect code and it appears that a call to onChange.emit is missing from the toggleAll method;

this.onChange.emit({ originalEvent: event, value: this.value });

Environment

windows and maxos

Reproducer

https://stackblitz.com/edit/vr5hjz-sr3m4a

Angular version

17.x

PrimeNG version

17.3.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.18.1

Browser(s)

safari, chrome, firefox

Steps to reproduce the behavior

  1. Run the reproducer: https://stackblitz.com/edit/vr5hjz-sr3m4a
  2. Click on the multiselect's filter "select all" checkbox (the check box next to the filter text input field)
    -- The "From Model" output list displays all cities (good)
    -- The "From Listener" output list remains empty (bad)

Expected behavior

Both the "From Model" and "From Listener" output lists would each display a list of all the cities

@rosenthalj rosenthalj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 22, 2024
@rosenthalj rosenthalj changed the title p-multiselect: onChange event is not triggered for filter select all/unselect all p-multiselect: onChange event is not triggered for multiselect's filter select all/unselect all Jan 22, 2024
@miki995
Copy link
Contributor

miki995 commented Jan 31, 2024

@mehmetcetin01140 @cetincakiroglu Any plans to review the PR and merge?

@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 Feb 5, 2024
@Da13Harris
Copy link

@rosenthalj I came here to write up this very same bug, but happy to see it's written up so well. Thanks!

Unfortunately, we've been facing a lot of bugs in the p-dropdown, p-multiselect, and p-autocomplete during this particular upgrade (from 16.0.2 to 17.5.0). I welcome the accessibility improvements, but sure hope these regression bugs get worked out sooner rather than later. Thanks to the PrimeNG team for all the effort you're putting in to fix things.

@rosenthalj
Copy link
Contributor Author

To help quickly identify the cause of this issue and to save PrimeNG developers time searching/comparing code:

primeng_src_app_components_multiselect_multiselect_ts_at_master_·primefaces_primeng_and_primeng_src_app_components_multiselect_multiselect_ts_at_15_4_1·primefaces_primeng_and_Inbox•_joseph_a_rosenthal_nasa_gov

PR #14604 is a simple fix that adds the missing call to onChange to multiselect's toggleAll method

@cetincakiroglu cetincakiroglu added this to the 17.8.0 milestone Feb 23, 2024
cetincakiroglu added a commit that referenced this issue Feb 23, 2024
…03_14252_14807

fixed #14807 #14252 #14603 - updated onToggleAll method to call onChange and onSelectAllChange
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
5 participants