-
-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
Describe the bug
When using Grid.js with client-side data in a React project, the pagination resets to the first page whenever the data or columns prop changes—even if I am controlling the current page via the pagination prop (page, onChange, and resetPageOnUpdate: false). This happens, for example, when toggling a cell’s expanded state, which updates the data array or columns (even if the data is memoized and stable).
To Reproduce
Steps to reproduce the behavior:
- Use Grid.js with client-side data and controlled pagination (pagination={{ page, onChange, limit, resetPageOnUpdate: false }}).
- Change the data or columns (e.g., by toggling a cell’s expanded state).
- Observe that the table jumps back to the first page, even though the page prop is set to a different value.
Expected behavior
When I control the current page via the pagination prop, Grid.js should respect the page value and not reset to the first page when the data or columns change.
Workarounds tried:
- Memoizing data and columns with useMemo
- Using resetPageOnUpdate: false
- Controlling page and onChange via React state
None of these prevent the page reset, making it difficult to implement interactive tables (e.g., expandable rows, cell toggles) without breaking the user’s pagination context.
Desktop (please complete the following information):
- OS: MacOS 15.3.2
- Browser: Chrome
- Version 135.0.7049.115
Additional context
Related Issues:
riyakhdl, aslongasoncehad and riya2305
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on