SelectionModel bug when using SingleSelection mode.
What is the expected behavior?
I expect for the item passed to the object to be shown as selected on the UI.
What is the current behavior?
the last item of the list is being selected and showed as selected on the UI.
What are the steps to reproduce?
const list = this.dimensionFilterService.getItemsList(); console.log('updating the data for the datasource');
this.dataSource.data = list; // MatTableDataSource object from Angular Mat
console.log('selecting the top of the list'); this.singleSelection = new SelectionModel(false, [list[0]]); // selectionModel obj with the first item of the list being passed as the item that should be selected.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 7.0.4 Material 7.0.4 TS: 3.1.6
All browsers are showing the same behavior
Is there anything else we should know?
Well for multiple selection its working as intended, the only problem is when i try to use the single selection mode.
Works for me
https://stackblitz.com/edit/angular-wckzop?file=package.json
Closing since @manklu's example shows it working. The issue can be reopened if there's an example of it failing.
Sorry guys, after week trying to solve this i just notice that what was the cause of the missing selection was a filterPredict in the MatTableDataSource.
Close this pls.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.