I'm using the Selection Data table
to deselect all the rows we use:
this.selection.clear();
where selection is an object of SelectionModel class. Now what if I want to remove the selection of specific row from code behind "component typescript code", is there any helpful "angular" statement just like clear() method?
You can use
this.selection.deselect(row)
this.selection.select(row)
Sample to deselect 5th row with mat-table
function to do select or deselect specific row.
Example: If you want to deselect 3rd
row you can do following.
this.selection.deselect(this.dataSource.data[2])
This the SelectionModel class code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With