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>