Multiple tables on same page

UI Components for Angular
Post Reply
smayer
Posts: 5
Joined: 26 Mar 2020, 17:26

03 Apr 2020, 14:58

I have a page:

Code: Select all

<app-new-grid [isTotals]="false"></app-new-grid>
<hr>
<app-new-grid [isTotals]="true"></app-new-grid>
Which renders fine (with differences by checking the isTotals variable) and is a table:

Code: Select all

<p-table #dt [value]="data" [columns]="cols" dataKey="name"
    [autoLayout]="true" sortMode="single" (sortFunction)="customSort($event)" [customSort]="true" (onFilter)="onFilter($event)">
Each grid is displayed correctly. However when I try to filter the first table, it is using the variables that were setup for the second table. Is this because of the #dt in the table declaration? How do I solve this?

smayer
Posts: 5
Joined: 26 Mar 2020, 17:26

03 Apr 2020, 17:02

I figured out that the problem was related to using FilterUtils.

import { FilterUtils } from 'primeng/utils';

FilterUtils['soldRangeFilter'] = (value, filter): boolean => {
return value >= this.soldRangeValues[0] && value <= this.soldRangeValues[1];
}

since the id was the same in both grids, the second one overwrote the first. Is there a way to create a unique instance of FilterUtils per component?

quartelh
Posts: 12
Joined: 09 Oct 2018, 11:33

06 Jan 2022, 17:17

I run into the same issue.

I reuse a component containing a table with global filtering. When filtering the correct table is used (using ViewChild), but then calling .filterGlobal results in using the values of another table.

Any help is appreaciated

Best regards,
Herbert

jamesskurray
Posts: 10
Joined: 26 Jul 2017, 08:17

11 Feb 2022, 06:00

Filter utils is supposed to be keywords for each specific filter type. either work out a better generic filter or rename one of them.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest