【发布时间】:2021-04-08 16:14:47
【问题描述】:
在sample 之后,我知道我可以编写自己的this.dataSource.filterPredicate。只要我搜索一个字符串,它就可以正常工作。我想根据使用过的state (=myFilterState) 进行额外过滤。
我尝试使用谓词 like
this.dataSource.filterPredicate =
(data: MyElement, filter: string) => data.myType.useState === this.myFilterState;
我面临的问题是,当我更改this.myFilterState 时,过滤器不会重新评估,直到我更改filter 的字符串。只要filter 保持为空,filterPredicate 就不会被触发。
有没有办法手动触发它——尽管filter 的值是多少?
【问题讨论】:
标签: angular-material angular-material-table