-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Change page index base, from 1 to 0 #1021
Conversation
@@ -130,9 +130,9 @@ export function PaginationApiTests() { | |||
Pagination: ({ state }) => ( | |||
<Pagination | |||
className="my-custom-pagination" | |||
page={state.pagination.page} | |||
page={state.pagination.page + 1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need it here? Is it to load the second page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it to load the second page?
No it's for the component. As it's 0 indexed, we need to add 1 to convert it to the page number from the index
@material-ui/lab/Pagination
is 1-based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Broken demo: https://deploy-preview-1021--material-ui-x.netlify.app/components/data-grid/pagination/#server-side-pagination
- Broken demo: https://deploy-preview-1021--material-ui-x.netlify.app/components/data-grid/pagination/#apiref
- Could you add a breaking change section in the description of the pull request? In a format that we can then copy & paste once we do the changelog for the next release.
Breaking changes
[DataGrid] Change page index base, from 1 to 0. This change is done for consistency with
TablePagination
and JavaScript arrays that are 0-based. Material-UI still uses a 1-base page for thePagination
component that matches the URL's query.fix #852