-1

While expanding multiple rows in a Material Mat-Table in which each row fetches data from an API , the dataSource is getting overridden for the already open rows , i.e - the first rows inner data is override by the second row inner data when 2nd row is opened . Similarly if 3rd row is opened all the inner data becomes same .

I tried changing the dataSource with dataSource[i] based on the index values but that didnt work .

I have a working stackblitz for the issue

1 Answers1

1

Using element.Id to access datasource array solves the problem. Like,

this.usersdataSource[element.Id] = new MatTableDataSource();

And you can use the same in template.

Updated the blitz for you. Updated code

Ms.Tamil
  • 350
  • 1
  • 14