I have a nested mat table with expandable rows . Only the inner table has checkbox and by default all the checkbox has to be checked in all the nested tables . Here is the working stackblitz
getProjectDetails(element: any) {
console.log(element.Id);
this.tableService.getInnerData(element.Id).subscribe((res) => {
if (res.length == 0) {
element['usersdataSource'] = new MatTableDataSource();
} else {
element['usersdataSource'] = new MatTableDataSource(res);
this.userSelectionMap.set(
element.Id,
new SelectionModel<any>(true, [element['usersdataSource']])
); // provided datasource of the current inner table for default sselection
}
});
}
I have provided the value of datasource for default selection while defining the selection model but it is not working as expected . I dont want to iterate over each table and do the selection as the data of inner table can be huge . What could be the best way to implement this ?
Aucun commentaire:
Enregistrer un commentaire