Component: Multiselect onChange not called
Describe the bug
Using a the MultiSelect component, the onChange callback does not emit when selecting all values through the upper checkbox that serves as a shortcut to select/unselect all values.
Environment
Ubuntu 23.10 Angular v17 Primeng 17.3.2
Reproducer
No response
Angular version
17.0.7
PrimeNG version
17.3.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v18.16.1
Browser(s)
No response
Steps to reproduce the behavior
template:
<p-multiSelect
[options]="mockupData"
(onChange)="onChangeCallback($event)"
(onSelectAllChange)="onSelectAllChangeCallback($event)"
></p-multiSelect>
typescript:
protected onChangeCallback(event: any): void {
console.log(event) // called only when a particular value is checked or unchecked
// selecting or deselecting all values through the shortcut checkbox does not call the line above
}
protected onSelectAllChangeCallback(event: any): void {
console.log(event) // not called neither when selecting or deselecting all values through shortcut checkbox
}
Expected behavior
onChange (i.e. "Callback to invoke when value changes") and onSelectAllChange (i.e "Callback to invoke when all data is selected") events should emit as the upper checkbox is clicked or unclicked.
We are also experiencing this with any version higher than 16.6.0. Looking at the change log between 16.6.0 and 16.7.0, there were three commits with MultiSelect. One commit has to do with the checkbox in the header, which I assume is the select all functionality. Perhaps this is where the problem was introduced?
Issue #14603 is the same issue as the first part of this issue : onChange (i.e. "Callback to invoke when value changes")
I created issue https://github.com/primefaces/primeng/issues/14603 which is a partial duplicate of this issue. It only fixes the "onChange event" problem addressed in this issue
I created pull request https://github.com/primefaces/primeng/pull/14604 which fixes only the onChange event problem
I created pull request #14826 which fixes this issue. PR #14826 supersedes PR #14604