javascript - 使用角度 9 中的垫选择过滤垫表
问题描述
<div class="row">
<div class="col-sm-3 col-md-3 col-lg-3 col-xs-3">
<mat-form-field class="form-field-width">
<mat-label>Status</mat-label>
<mat-select (ngModelChange)="onChangeStatus($event)" [(ngModel)]="selectedStatus">
<mat-option *ngFor="let option of options" [value]="option.value">
{{option.viewValue}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="col-sm-3 col-md-3 col-lg-3 col-xs-3">
<mat-form-field class="form-field-width">
<mat-label>Risk Category</mat-label>
<mat-select (ngModelChange)="onChangeRisk($event)" [(ngModel)]="selectedRisk">
<mat-option *ngFor="let risk of risks" [value]="risk.value">{{risk.viewValue}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
onChangeStatus(event){
const filterValue = event;
this.dataSource.filter = filterValue.trim().toLowerCase();
}
onChangeRisk(event){
const filterValue = event
this.dataSource.filter = filterValue.trim().toLowerCase();
}
大家好,我正在尝试使用 mat-select 框过滤 mat-table。但我无法做到这一点。如果我们在两个选择框中都选择选项,则表格应该过滤选项。请帮忙
解决方案
推荐阅读
- excel - 将 Excel 中的日期格式从 mm-dd-yy hh:mm 更改为 dd-mm-yy hh:mm
- python - 我怎样才能让 80 位浮点数在 numpy 中工作
- audio - 如何使用 Node.js 设置 Stun 服务器
- c++ - 将一个字符串与数组中的另一个字符串进行比较
- thymeleaf - Thymeleaf - 包含来自同一目录的模板(相对路径)
- swift - 在函数声明警告中找不到 Firebase Firestore 参数“selected_port [out]”
- javascript - 如何使用javascript在段落中显示代码
- c - C中的和积
- javascript - 如何从 OAuth facebook nodejs 获得生日?(我可以在终端登录但无法访问)
- excel - 如何通过列的数值定义范围?