How to get Filtered records from MatTableDataSource in angular 6

Viewed 9173

I created an instance of MatTableDataSource then added data to it and bind it to mat-table. Later I applied filter to this datasource and it showed filtered rows in the mat-table. How can I get these filtered rows in code.

1 Answers

If the MatTableDataSource and filter field are bound properly, you can get filtered records like so:

var filteredData = this.dataSource.filteredData;
Related