Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 隐藏角度数据表中的几行_Angular_Angular Material - Fatal编程技术网

Angular 隐藏角度数据表中的几行

Angular 隐藏角度数据表中的几行,angular,angular-material,Angular,Angular Material,我想隐藏满足某些条件的几行(例如disabled:true) html: 这是 我想隐藏禁用了的行:true。(在上面的示例中,位置8、9、10)。 我已经设置了dataSource.filterPredicate,以便在禁用时返回false:true this.dataSource.filterPredicate = (data: PeriodicElement, filter: string) => { if (data.disabled) { return

我想隐藏满足某些条件的几行(例如
disabled:true

html:

这是

我想隐藏禁用了
的行:true
。(在上面的示例中,位置8、9、10)。 我已经设置了
dataSource.filterPredicate
,以便在
禁用时返回
false
:true

this.dataSource.filterPredicate = (data: PeriodicElement, filter: string) => {
      if (data.disabled) {
        return false;
      }
      :
当筛选器字符串不为空时,此选项起作用。但当过滤器字符串为空时,将显示位置8、9、10

如何修复此问题,以便始终隐藏禁用了
的行:true

自解析

我应该在HTML中设置
[隐藏]

<tr mat-row *matRowDef="let row; columns: displayedColumns;" [hidden]="row.disabled == true"></tr>

this.dataSource.filterPredicate = (data: PeriodicElement, filter: string) => {
      if (data.disabled) {
        return false;
      }
      :
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [hidden]="row.disabled == true"></tr>