【发布时间】:2022-01-07 07:06:19
【问题描述】:
根据https://www.primefaces.org/primeng/#/table 的文档,reset 方法应该是“重置排序、过滤和分页器状态”。 问题是重置表方法不会从 UI 中删除过滤器。 (虽然 table.ts 中的过滤器字段在重置后是 {})
请查看我复制它的this。 代码可见here 按失败字段(或任何其他字段)过滤汇总表(参见示例)。 按复位。 => 表格值将被重置,但过滤器值仍然可见。
该示例适用于基本表,但也不适用于动态列。
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field">
{{col.header}}
<p-sortIcon [field]="col.field"></p-sortIcon>
</th>
</tr>
<tr>
<th *ngFor="let col of columns">
<input pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
</th>
</tr>
您对如何清除输入中的过滤器有任何想法吗?
【问题讨论】:
标签: primeng