-
-
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] Fix page count selector #12343
Conversation
Deploy preview: https://deploy-preview-12343--material-ui-x.netlify.app/ |
apiRef.current.setState((state) => ({ | ||
...state, | ||
props: { | ||
rowCount: props.rowCount, |
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.
I think we have to make rowCount
part of the state for the server-side data source (a controlled state) as we need to update it internally based on different factors, I wanted to make it part of the pagination state, i.e. pagination.rowCount
which should fix the page count selector as well.
PR / file where I tried to do it.
Would it be useful to still keep this prop in state (as a prop)?
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.
Ah ok. Seems like it would make the selector work. Do you want to handle this issue in your PR or should we merge this as it is and you pick it up in your PR?
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.
Whatever you prefer, ideally it'd be better to do it in my PR (I'll most likely extract the independent changes in separate PRs which will allow to deliver them sooner)
We could keep this PR open though, if we have another prop to make part of state we can update the PR and merge it.
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.
I'll let you handle the issue then. I'll close, we can reopen anytime.
Closes #8450
Add one prop in the state so we can use it in the selector.
Before: https://codesandbox.io/s/brave-goldberg-3lve8e?file=/demo.tsx