0

Hi I have a Mat table with expand collapse option.

I have used exactly the below link for my reference.

https://stackblitz.com/edit/angular-material2-expandable-rows-filter-pagination-sorting

Now the problem is I need to collapse all the previous opened row before opening the new row.

Can someone please help me in this.

  • Check this out : https://stackoverflow.com/questions/46123854/expandable-table-rows-in-angular-4-with-angular-material – Sangwin Gawande Jan 30 '19 at 06:54
  • Thans @SangwinGawande, this is having a row which is hidden and gets expanded with the above row is clicked. but my problem is I need pagination also. In the above mentioned case, the pagination count is almost doubled :( – Mohan Kumar P R Jan 30 '19 at 11:00

1 Answers1

0

Hello see this https://stackblitz.com/edit/angular-material2-expandable-rows-filter-pagination-sort-7jpsik?file=app%2Ftable-example.ts

this add a event emitter in cdk-detail-row-directive.ts in this way:

@Output() toggleChange = new EventEmitter(); // added

and when the toggle function is call yo add this:

this.toggleChange.emit(this); // added

See table.example.ts for more changes