[data grid] onPaginationModelChange details property is not defined / useful in v7+ #12897
Labels
component: data grid
This is the name of the generic UI component, not the React module!
feature: Pagination
Related to the data grid Pagination feature
good first issue
Great for first contributions. Enable to learn the contribution process.
regression
A bug, but worse
Steps to reproduce
Link to live example: (required)
v6 Pagination
v7 Pagination
Steps:
{ reason: 'setPaginationModel' }
{ reason: undefined, api: {...} }
Current behavior
The details property is not defined when using the Grid pagination controls.
Expected behavior
The details property should have a string value for reason when using the Grid pagination controls.
Context
In v6 the DataGridPro would give a reason when using the Grid pagination controls. This made it possible to distinguish between a manual pagination model change versus a Grid pagination control model change.
An example of a manual pagination change is an Add button in the Grid toolbar that adds a new row. When pagination is enabled and a new row is added we should take the user to the page where the new row resides. If pageSize is 5 and a 6th row is added we should navigate the user to the second page with the new row. This was possible in v6 because the reason would be undefined and a developer could tell when a manual pagination model change had been made. Otherwise a reason is given and we honor the model suggested by onPaginationModelChange.
In v7 the details property value has changed from { reason: string } to { reason: undefined, api: {...} }. This caused a major breakage in our implementation and we have had to come up with a custom solution to get around the issue. To make the situation worse, there was no notice given about this change and I cannot find any record of this change.
Please advise, is there an alternative method? Should I just use the API even though the documentation suggests not to?
Your environment
npx @mui/envinfo
Search keywords: grid pagination details bug
Order ID: 83568
The text was updated successfully, but these errors were encountered: