使用角度9中的垫选择在垫桌上过滤

时间:2020-07-02 04:23:28

标签: javascript angular typescript

<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。但是我做不到。如果我们在两个选择框中都选择了选项,则表格应该对选项进行过滤。请帮忙

0 个答案:

没有答案