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

[DataGrid] Fix page count selector #12343

Closed
wants to merge 4 commits into from

Conversation

romgrk
Copy link
Contributor

@romgrk romgrk commented Mar 5, 2024

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

@mui-bot
Copy link

mui-bot commented Mar 5, 2024

Deploy preview: https://deploy-preview-12343--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against a959556

apiRef.current.setState((state) => ({
...state,
props: {
rowCount: props.rowCount,
Copy link
Member

@MBilalShafi MBilalShafi Mar 6, 2024

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)?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

@romgrk romgrk closed this Mar 6, 2024
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] Fix gridPageCountSelector selector
4 participants