且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用角度过滤过滤角度材料表中的特定列?

更新时间:2023-11-12 08:41:34

您必须覆盖数据源的 filterPredicate.

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);
};