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

Unable to change pages in a DataTable component with a paginator when onPage is defined #7238

Closed
pyth opened this issue Sep 24, 2024 · 2 comments
Labels
Resolution: By Design The behavior in the issue is by design and the component exhibits the expected behavior

Comments

@pyth
Copy link

pyth commented Sep 24, 2024

Describe the bug

When using DataTable with a paginator, switching to any page becomes impossible as soon as the onPage event handler is defined.

It looks like setFirstState and setRowsState in the onPageChange function only get called if props.onPage is falsy.

Reproducer

https://stackblitz.com/edit/mzbkfv?file=src%2FApp.jsx

System Information

System:
    OS: Linux 6.10 Manjaro Linux
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 18.07 GB / 31.29 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.7.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.3 - /usr/bin/npm
    pnpm: 9.11.0 - /usr/bin/pnpm
  Browsers:
    Chromium: 129.0.6668.58
  npmPackages:
    primereact: ^10.7.0 => 10.8.2 
    react: ^18.3.1 => 18.3.1

Steps to reproduce the behavior

  1. Create a DataTable component with a paginator
  2. Pass a function as the onPage event handler to the DataTable component
  3. Try to switch the page in the paginator

Expected behavior

Being able to change to another page in the paginator as well as being able to react to the page change.

@pyth pyth added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 24, 2024
@melloware melloware added Resolution: By Design The behavior in the issue is by design and the component exhibits the expected behavior and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 24, 2024
@melloware
Copy link
Member

See this its by design when you use onPage you are switching the table to controlled mode: #5795

@pyth
Copy link
Author

pyth commented Sep 24, 2024

Thank you!

@pyth pyth closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: By Design The behavior in the issue is by design and the component exhibits the expected behavior
Projects
None yet
Development

No branches or pull requests

2 participants