primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.21k stars 4.55k forks source link

p-table: RowGroup not grouping on subsequent pages #12185

Open psarno opened 1 year ago

psarno commented 1 year ago

Describe the bug

We have a p-table component using [lazy]="true" and the following ng-templates:

<ng-template pTemplate="groupheader" let-rowData let-rowIndex="rowIndex" let-expanded="expanded">

<ng-template pTemplate="rowexpansion" let-rowData let-columns="columns">

We also have the row toggle as [pRowToggler]="rowData".

On the first page, it correctly groups by the groupheader / pRowToggler, but on all subsequent pages the grouping stops and each line is shown individually.

Page 1:

image

Page 2:

image

Environment

Versions Below.

Reproducer

https://stackblitz.com/edit/github-sb1bvu

Angular version

14.2.9

PrimeNG version

14.2.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.13.1

Browser(s)

No response

Steps to reproduce the behavior

  1. Lazy load data into a p-table component with a paginator
  2. Click on any page other than page 1
  3. Note that the grouping is no longer applied
  4. In Stackblitz repo, click page 2, rows no longer grouped:

image

Expected behavior

The unique rows should be grouped regardless of what page is currently being displayed in the table.

psarno commented 1 year ago

Any chance on getting a triage on this? The Stackblitz clearly shows the repro and this is causing us issues in production.

marcoschndlr commented 3 weeks ago

This still happens with the latest version, and just using the paginator with row grouping is enough for this problem to occur. I created a new Stackblitz with the latest version and a minimal example: https://stackblitz.com/edit/github-h9bjw4-vgqkeu

I think the bug is caused by this line https://github.com/primefaces/primeng/blob/1f6c5d95271e5b48aabdcd15bc040a1f3bea5adc/src/app/components/table/table.ts#L3220

Specifically the subtraction of this.dt._first.