I've been trying a few things but nothing. Here's what I am trying - simple button outside my DataTable to filter on name column when clicked:
Code: Select all
<button class="btn btn-outline-primary" (click)="dt.filter('A','name','startsWith')">Filter on A</button>
Code: Select all
<p-dataTable [value]="organizations" [globalFilter]="orgFilter" selectionMode="single" dataKey="name" #dt>
<p-column field="name" header="Name" [filter]="true" filterMatchMode="startsWith">
<template let-col let-organization="rowData" pTemplate="body">
<img src="/dist/assets/images/{{organization.type.replace(' ', '').toLowerCase()}}.png" class="type-icon" /><strong>{{organization[col.field]}}</strong>
</template>
</p-column
</p-dataTable>