4

How to fetch selected rows from a mat-table selection

StackBlitz Example

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84

1 Answers1

13

You can get the selected or checked item of Material Selection Table by using:

this.selection.selected

this will gives you the checked items from the table.

StackBlitz Example

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
  • Hello, after retreiving the checked items, how can I uncheck items? For example, i am trying to avoid items from being checked after 15 items, but when i reach the item number 15 i can prevent from being added to the list, but i cannot avoid the check on that item, how can i avoid items from being checked after the item number 15? – Jonny May 22 '19 at 02:31
  • @Jonny give me some time, will check it – Prashant Pimpale May 22 '19 at 03:50
  • @Jonny Can you show me the code? Or Stackblitz example so I can check there – Prashant Pimpale May 22 '19 at 05:07
  • Thanks for your response, i already did it, but now i have the problem that i cannot retrieve the selected items when i return and load them from the backend, the list keep showing that none is selected. – Jonny May 22 '19 at 19:30