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

Selection with pagination: p-table with selectionMode="multiple" and lazy loading #10357

Closed
noebug opened this issue Jun 23, 2021 · 1 comment

Comments

@noebug
Copy link

noebug commented Jun 23, 2021

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
https://stackblitz.com/edit/github-me2euc?file=src%2Fapp%2Fapp.component.ts

Current behavior
The "select all" header checkbox in a p-table with lazy loading enabled and selectionMode="multiple" selects the data only from the current page and remains selected for the next ones, however in the next pages the elements are not selected.
p1
p2

Expected behavior
It would be great to customize the "select all" in the header checkbox for all the pages or by page when we use a table with lazy loading.
If we want to keep the behaviour from the p-table without lazy loading, then we would do a select all only for the data we have in the current page, but as we would navigate to page 2, we could add to the already selected elements all the elements selected from page 2, using the header checkbox.

Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/github-me2euc?file=src/app/app.component.ts
To reproduce the issue click the header checkbox on the first page then navigate to page 2, page 3
On page 1 - all the elements are selected
On page 2 - only the header checkbox is selected, but the elements are not selected

What is the motivation / use case for changing the behavior?
The current behaviour works consistently for p-table without lazy loading, when all the elements get selected.
But if we use lazy loading and retrieve the data from backend, as we navigate from page to page, there is inconsistency.
Because even if we click the select all header checkbox, only the data from first page gets selected and the data from the other pages stays unselected with the select all header checkbox selected.
It is really misleading for a user, because we have two different behaviours here.

Please tell us about your environment:
Node: 14.15.1
Package Manager: npm 6.14.8
OS: win32 x64

  • Angular version: 5.X
    Angular: 12.0.5

  • PrimeNG version: 5.X
    "primeng": "^12.0.0",

  • Browser: [all]

  • Language: [all]

  • Node (for AoT issues): node --version = v14.15.1

@yigitfindikli yigitfindikli added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Jun 24, 2021
@mertsincan mertsincan removed the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Dec 14, 2021
@mertsincan
Copy link
Member

Hi,

Fixed in #10951. Also, I added a demo related to it on next version.

Best Regard,

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

No branches or pull requests

3 participants