【发布时间】:2019-08-11 05:23:10
【问题描述】:
我想知道是否可以使用对象数组将某些内容过滤到表格中?
我正在使用 Angular 6 和 PrimeNG 7
我的 p 表如下所示:
<p-table #table class="ui-table ui-table-responsive" [value]="arrays" [columns]="cols" >
...
<div class="col-xl-4">
<i class="fa fa-search" style="margin:4px 4px 0 0"></i>
<input type="text" pInputText size="50" placeholder="Rechercher" (input)="table.filter($event.target.value, cols['sort'], 'contains')" style="width:auto">
</div>
...
<p-table>
我想使用 filter() 而不是 globalFilter() 因为我需要指定要过滤的字段。
cols的内容是这样的:
this.cols = [
{ field: 'number', sort: 'number', header: 'The number' },
{ field: 'type', sort: 'type', header: 'The type' },
{ field: 'place', field2: 'placeName', sort: 'place.placeName', header: 'The place'},
{ field: 'city', field2: 'cityName', sort: 'city.cityName', header: 'The city' },
...
...
];
目前我的过滤器不起作用..
【问题讨论】:
标签: angular typescript filter primeng primeng-turbotable