I'm looking for a method to extract sorted data and save it under sortedData from dataSource of mat-table in order to save it to CSV file. There are filters and pagination applied to dataSource through
this.dataSource.filterPredicate; this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort
and I couldn't find any working solution except this
this.dataSource.connect().subscribe((data) => (this.sortedData = data))
but this solution returns data limited only to single page when applying MatPaginator and this
this.sortedData = this.dataSource.sortData(this.dataSource.data, this.dataSource.sort)
which returns all data ignoring filtration.
Any ideas how could I get all sorted and filtered data (data of all pages) from dataSource?
You can use filteredData :