Filtering specific column in Angular Material Table with filtering in angular?

You have to override the filterPredicate of your dataSource.

Here’s an example of how to do it: Working demo


Essentially, you want to specify what properties in your data the filter is applied to:

this.dataSource.filterPredicate = function(data, filter: string): boolean {
    return data.name.toLowerCase().includes(filter) || data.symbol.toLowerCase().includes(filter) || data.position.toString().includes(filter);
};

Leave a Comment