具有角形材料的多个过滤器

我正在使用有角材料进行样式化的有角8项目。我使用了带有过滤器的mat-table来过滤来自mat-table的数据。默认的垫子表格过滤器过滤包含输入字符的数据。但是我想一次在mat-table中使用两个过滤器,即默认过滤器和按域(表中的列)过滤的过滤器,它将使用下拉列表进行过滤。经过研究,我发现我可以通过定义filterPredicate来使用列过滤数据,该方法接受列进行过滤,但是有什么方法可以同时使用默认过滤器和列过滤器?

下面是我的带有屏幕截图的过滤器代码

applyFilter(filterValue: string) {
    if (this.search) {
      this.domainSelect = '';
    }
    this.dataSource.filter = filterValue.trim().toLowerCase();
  }

 // Below method is in complete and will be implemented for Domain Filter

  applyDomainFilter(filterValue: string) {
    filterValue = filterValue.trim().toLowerCase(); 
    this.dataSource.filter = filterValue;
  }

具有角形材料的多个过滤器

谢谢

qwq200481 回答:具有角形材料的多个过滤器

我总是使用一种方法来设置由字符串类型确定的多个过滤器。

 BigDecimal x = ...
 if (x.compareTo(BigDecimal.ZERO) == 0) {
     // it is zero
 } else {
     // it is not zero
 }

在我的过滤条件中,您可以决定是否要完全匹配所有过滤条件,或者至少要匹配一个过滤条件。我总是用逻辑applyFilter(value: any,type: string) { switch(type) { case 'name': this.filterObject.name = value; break; case 'domain': this.filterObject.domain = value; break; default: break; } this.dataSource.filter = JSON.stringify(this.filterObject); } 连接我的过滤器。

AND
本文链接:https://www.f2er.com/3146924.html

大家都在问