This is my Datatable:
Code: Select all
<p-dataTable emptyMessage="Keine Benutzer gefunden" [value]="users" dataKey="id" [loading]="loading" [rows]="15" [paginator]="true"
[pageLinks]="3" [globalFilter]="gb" #dt>
<!-- This column works fine, it has a "field" -->
<p-column field="state" [filter]="true" filterMatchMode="in">
<ng-template pTemplate="filter" let-col>
<p-multiSelect [options]="status" defaultLabel="Status" (onChange)="dt.filter($event.value,col.field,col.filterMatchMode)"
styleClass="ui-column-filter"></p-multiSelect>
</ng-template>
</p-column>
<!-- This column does not have a "field", but I would like the same multiselect filter as the previous column. -->
<p-column header="Rolle" sortable="true" [filter]="true" filterMatchMode="in">
<ng-template let-col let-user="rowData" pTemplate="body">
<div *ngFor="let role of user.roles">
<p>{{role.role}}</p>
</div>
</ng-template>
</p-column>
</p-dataTable>
Code: Select all
<ng-template pTemplate="filter" let-col>
<p-multiSelect [options]="roles" defaultLabel="Rollen" (onChange)="dt.filter($event.value,col.field,col.filterMatchMode)"
styleClass="ui-column-filter"></p-multiSelect>
</ng-template>
How can I achieve this ?
Cheers