question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mat-selection-list: selectAll and deselectAll methods should trigger selectionChange event

See original GitHub issue

selectAll() and deselectAll() methods on MatSelectionList should automatically trigger the selectionChange event.

What is the use-case or motivation for this proposal?

Select some documents from a list.

The MatListOptions have [value] populated with an object containing a number of properties of the document (name, file size, last edited date, expiry date, etc.). You want to communicate a warning to the user that specifies the number of expired documents in their current selection. It’s easy enough to calculate the number of expired documents in the current selection when the selectionChange event is fired, but if the user decides to selectAll, this event is not triggered, so additional workarounds need to be made to cover this case.

Is there anything else we should know?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
despiancommented, Jun 26, 2019

What if you have a user interaction wired up to selectAll/deselectAll?

I think it would be nice to have the option to trigger this event without having to write extra code.

How about an optional extra parameter to the selectAll and deselectAll methods which would fire the event?

E.g.

selectAll(fireSelectionChange: boolean = false): void {
  ...
}
1reaction
jelbourncommented, Sep 17, 2020

Seeing this now- I believe we should emit the event when the change comes from the user pressing Ctrl + A to trigger the select-all / deselect-all (but not when it happens programatically).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select All mat option and deselect All - Stack Overflow
When user selects 4 options one by one then All shall be selected. HTML file <mat-select placeholder="User Type" formControlName="UserType" ...
Read more >
Mat Selection List Select Deselect All No Selection ... - StackBlitz
List with selection does not fire selectionChange event when selecting/deselecting all values.
Read more >
mat select selected Code Example - Code Grepper
mat select on select ; 1. <mat-form-field> ; 2. <mat-select placeholder="State" (selectionChange)="someMethod($event.value)"> ; 3. <mat-option * ...
Read more >
Selectionchange Angular - Vela Cloud
You need to apply selectionChange on your mat-selection-list like this ... selectionChange event should. angular call function on option select. step by ...
Read more >
Selectionchange Angular
In this article, we will implement a angular input field change event example. input ... Use selectionChange on the MatSelectionList instead. angular call ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found