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

[data grid] How to get the total row count including children rows #13638

Closed
dassoumyashree opened this issue Jun 26, 2024 · 5 comments · Fixed by #13725
Closed

[data grid] How to get the total row count including children rows #13638

dassoumyashree opened this issue Jun 26, 2024 · 5 comments · Fixed by #13725
Labels
component: data grid This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@dassoumyashree
Copy link

dassoumyashree commented Jun 26, 2024

The problem in depth

I am using the row grouping feature with mui premium. By default, the total row count is calculated based on a number of parent rows (top-level rows). I need a way to set the page row count based on the number of child rows. Is there any way to do that?

Your environment

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: Page count to be set as number of child rows with row grouping

@dassoumyashree dassoumyashree added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users support: unknown Support request type not verified yet. Head to https://tools-public.mui.com/prod/pages/jyhs86t labels Jun 26, 2024
Copy link

You have created a support request under the "Priority Support" terms, which is a paid add-on to MUI X Premium ⏰. Please validate your support key using the link below:

https://tools-public.mui.com/prod/pages/jyhs86t?repo=mui-x&issueId=13638

Do not share your support key in this issue!

Priority Support is only provided to verified customers. Once you have verified your support key, we will remove the support: unknown label and add the support: priority label to this issue. Only then the time for the SLA will start counting.

@DanailH DanailH added support: question Community support but can be turned into an improvement and removed support: commercial Support request from paid users support: unknown Support request type not verified yet. Head to https://tools-public.mui.com/prod/pages/jyhs86t labels Jul 4, 2024
@DanailH DanailH changed the title [question] I am using the row grouping feature with mui premium. By default the total row count is calculated based on number of parent rows (top level rows). I need a way to set the page row count based on the number of child rows. Is there any way to do that? [data grid] How to get the total row count including children rows Jul 4, 2024
@DanailH
Copy link
Member

DanailH commented Jul 4, 2024

Hi @dassoumyashree you can use the getRowsCount() API method from the useGridApiRef() hook to get the total number of rows. You can find more about it here: https://mui.com/x/api/data-grid/grid-api/#grid-api-prop-getRowsCount

This will work if your rows are all loaded. If you use a server-side loading strategy then you would need to use the estimatedRowCount method to pass in the row count. You can find more about it here: https://mui.com/x/api/data-grid/data-grid-premium/#data-grid-premium-prop-estimatedRowCount

@DanailH DanailH closed this as completed Jul 4, 2024
@DanailH DanailH added the component: data grid This is the name of the generic UI component, not the React module! label Jul 4, 2024
Copy link

github-actions bot commented Jul 4, 2024

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@dassoumyashree: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@KenanYusuf
Copy link
Member

After discussing with @DanailH, I am going to re-open this issue as we discovered that getRowsCount() does not update when rows are filtered.

@dassoumyashree I am working on a recipe to help with this question, should have something to share soon.

@KenanYusuf KenanYusuf reopened this Jul 4, 2024
@KenanYusuf KenanYusuf self-assigned this Jul 4, 2024
@KenanYusuf KenanYusuf removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 4, 2024
Copy link

github-actions bot commented Jul 8, 2024

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@dassoumyashree: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

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! support: question Community support but can be turned into an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants