[英]Adding column filters to Angular collapsible material table
我正在使用具有可折疊功能的角形材料表。 根據角度材料文檔,我有以下代碼塊。 但它不適用於我的數據源。 有誰知道這有什么問題?
HTML
<mat-form-field>
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
JS
applyFilter(filterValue: string) {
this.dataSource.filter = filterValue.trim().toLowerCase();
}
您可能需要定義自定義filterPredicate
因為在某些情況下默認實現不會按預期工作。
this.dataSource.filterPredicate = function (data:Element, filter: string){
// return true if filter string match with the data Element
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.