I wanted to know if it was possible to use an array of objects for filtering something into a table ?
I'm using Angular 6 and PrimeNG 7
My p-table looks like this:
<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>
I want to use filter() and not globalFilter() because i need to specify the field that i want to filter.
The content of cols is this:
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' },
...
...
];
For the moment my filter won't work..