Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #15192: Row grouping breaks after first page #16307

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

marcoschndlr
Copy link
Contributor

Fixes #15192

What was the problem

shouldRenderRowGroupHeader expects the rowIndex to be the absolute index (i.e. first + rowIndex) when paginated.
The problem was that the rowIndex passed starts from 0 for every page, and the index calculation in the method then resulted in a negative number.

How was the problem solved

For expanded rows, the method getRowIndex is used, which adds the starting offset (first) to the rowIndex.
This method is used here now as well.

Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
primeng ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 7:30am

@nckirik
Copy link

nckirik commented Sep 16, 2024

this should be also applied to group footers

also shouldRenderRowGroupFooter method is calculating the wrong index.

it should be like this

    shouldRenderRowGroupFooter(value: any, rowData: any, i: number) {
        let currentRowFieldData = ObjectUtils.resolveFieldData(rowData, this.dt.groupRowsBy);
//        let nextRowData = value[i + (1 + this.dt._first)];
        let nextRowData = value[i + (1 - this.dt._first)];
        if (nextRowData) {
            let nextRowFieldData = ObjectUtils.resolveFieldData(nextRowData, this.dt.groupRowsBy);
            return currentRowFieldData !== nextRowFieldData;
        } else {
            return true;
        }
    }

@cetincakiroglu cetincakiroglu merged commit 3120e14 into primefaces:master Sep 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grouping Functionality in p-table Breaks After Pagination Navigation Beyond First Page
3 participants