【发布时间】:2022-01-27 03:42:04
【问题描述】:
我有一个带有 2 个过滤器选项条件的垫表。 我可以使用一种条件进行过滤,就像在 MatTableDatasource 上的普通过滤器一样, 就像我选择一个出纳员姓名或一个交替的日期,
但是,如果我设置两个过滤条件,则无法过滤
出纳员姓名和她今天的收款日期。
HTML
<label>Teller Name: </label>
<select
name="tellerName"
(change)="applyFilter($any($event.target).value)">
<option value="{{tellerList.collectorName}}"
*ngFor ="let tellerList of tellerList"
>{{tellerList.collectorName}}</option>
</select>
<label>Collection Date:</label>
<input
type="date"
name="collectionDate"
(change)="applyFilter($any($event.target).value)"
>
TS
applyFilter(filterValue:string) {
this.dataDepoSource.filter = filterValue.trim().toLowerCase();
}
数据源是通过一个可观察的服务来自一个火库
this.customerService.getDeposit().subscribe( depObs => {
this.depositList = depObs;
this.dataDepoSource = new MatTableDataSource(depObs);
});
【问题讨论】: