Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeNG <p-table> global filter is not working in angular

Tags:

primeng

<p-table #dt [scrollable]="true" scrollHeight="232px" [columns]="cols" [value]="packageList" selectionMode="single" [responsive]="true" [paginator]="false" [rows]="noOfRow" sortField="id" sortOrder="-1" [lazy]="true" (onLazyLoad)="loadPackageList($event)" [totalRecords]="totalRecords">

I have entered code here to use this much attribute. I need to use global filter but it is not working. <input type="text" pInputText size="50" placeholder="Global Filter" (input)="dt.filterGlobal($event.target.value, 'contains')" style="width:auto">

like image 302
Surendranath Sonawane Avatar asked Jun 08 '18 17:06

Surendranath Sonawane


People also ask

How do I change the PrimeNG Datatable P column date format?

You can do this by configuring the PrimeNgConfig: in your i18n assets (could also be just a typescript constant): "primeng": { ... "dateFormat": "dd.

How do I turn off sort in PrimeNG table?

Save this question. Show activity on this post. cols = [ { field: 'name', header: 'Name', sort: true }, { field: 'age', header: 'Age', sort: true }, { field: 'gender', header: 'Gender', sort: false }, { field: 'status', header: 'Status', sort: false } ];


1 Answers

After some code testing, I found an issue, that I have used lazy attribute. [lazy]="true" because of filterGlobal is not working. I did conditionally true /false to lazy parameter. when lazy="false" then only filterGlobal is working like a charm.

like image 104
Surendranath Sonawane Avatar answered Oct 07 '22 16:10

Surendranath Sonawane