This is my column:
Code: Select all
<p-column header="Roles" sortable="true" [filter]="true" filterMatchMode="contains">
<ng-template let-user="rowData" pTemplate="body">
<div *ngFor="let role of user.roles">
{{role.name}}
</div>
</ng-template>
</p-column>
Code: Select all
[ { "id": 3, "name": "A single role" } ]
[ { "id": 4, "name": "A role name" }, { "id": 6, "name": "Another role name" } ]
Code: Select all
<ng-template pTemplate="filter" let-col let-test="rowData">
<p-multiSelect [options]="roles" defaultLabel="All roles" (onChange)="dt.filter($event.value,test.roles,col.filterMatchMode)"
styleClass="ui-column-filter"></p-multiSelect>
</ng-template>
Code: Select all
this.roles = [];
this.roles.push({ label: 'A role', value: 'aRole' });
this.roles.push({ label: 'Another role', value: 'anotherRole' });
- How can I achieve this ?Cannot read property 'roles' of undefined
- How can I debug inline function calls like "dt.filter($event.value,test.roles,col.filterMatchMode)" ?
Cheers,
Para