Filtering specific column in Angular Material table in angular 5

前端 未结 8 840
太阳男子
太阳男子 2020-12-01 07:11

In Angular material official website it is mentioned that filterPredicate: ((data: T, filter: string) => boolean) will filter data based on specific field. But don\'t gettin

8条回答
  •  感动是毒
    2020-12-01 07:30

    You have to override the filterPredicate of your dataSource.

    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(data.symbol.toLowerCase().includes(filter) || data.position.toString().includes(filter);
    };
    

提交回复
热议问题