Sundar
Sundar

Reputation: 665

How to retain column index while we filter data in Angular Material data table?

Is there any way we can invoke any function while we any value is entered in angular material data table filter field? As we want to maintain the column current index value while we filter for result. We are using Angular 6 for our project.

Upvotes: 0

Views: 609

Answers (1)

heartworm
heartworm

Reputation: 21

If you're having a problem with accessing the correct index after filtering the data table, make sure you're using the filteredData property, and not the data property.

For example;

data: this.dataSource.filteredData[index]

Upvotes: 2

Related Questions