更新时间:2023-11-20 12:56:58
,您应该使用 MatTableDataSource
初始化this.dataSource之后,按如下所示定义自定义filterPredicate函数;
after you initialize this.dataSource, define a custom filterPredicate function as follows;
this.dataSource = new MatTableDataSource(results);
this.dataSource.sort = this.sort;
this.dataSource.filterPredicate = function(data: any, filterValue: string) {
return data.specificColumn /** replace this with the column name you want to filter */
.trim()
.toLocaleLowerCase().indexOf(filterValue.trim().toLocaleLowerCase()) >= 0;
};