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

[question] Are there plans to implement a DataGridPro footer that doesn't require a finite rowCount #4323

Closed
2 tasks done
jorjen opened this issue Mar 31, 2022 · 8 comments · Fixed by #12474
Closed
2 tasks done
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation support: question Community support but can be turned into an improvement

Comments

@jorjen
Copy link

jorjen commented Mar 31, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

Say I have no way of knowing the total row count that the server has, thus not being able to provide a definite rowCount, is there a way to display the total rows differently? Similar to a "see more" or have the ">" button clickable until no records can be fetched from the server?

Examples 🌈

image

Motivation 🔦

I have a use case where the exact total count of data/rows is not known--i.e., DynamoDB table without scanning the whole table.

Order ID 💳 (optional)

No response

@jorjen jorjen added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 31, 2022
@DanailH
Copy link
Member

DanailH commented Apr 1, 2022

Hey, @jorjen thanks for raising this!
Yes, there is a way to overwrite the default behavior. You can provide your own translation of the footerTotalVisibleRows in the localeText prop. It accepts a callback and returns a string. You can check its signature here -> https://github.com/mui/mui-x/blob/master/packages/grid/x-data-grid/src/constants/localeTextConstants.ts#L97
You can find more about it here -> https://mui.com/components/data-grid/localization/

Hope that answers your question.

@DanailH DanailH added support: question Community support but can be turned into an improvement component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 1, 2022
@jorjen
Copy link
Author

jorjen commented Apr 1, 2022

Hi @DanailH,

Thank you for the response. I tried providing a translation for footerTotalVisibleRows but for some reason it is not being reflected (not being overwritten?). Am I missing something?

Below is when I tried overwriting footerRowSelected and footerTotalVisibleRows by concatenating +added text+ to both. footerRowSelected seems to reflect the change, but footerTotalVisibleRows seems not to.

CodeSandbox of Data Grid - Localization example...
image

@jorjen
Copy link
Author

jorjen commented Apr 7, 2022

Hi @DanailH,

Hoping to get your feedback on above. Thanks.

@StephenStrickland
Copy link

@jorjen I was running into a similar issue. Seems like the style of paging that we're wanting is currently a low priority item, see #409

I was able to get close to what I need with this example: https://stackblitz.com/edit/react-ujnaza?file=demo.tsx

It looks like localText.footerTotalVisibleRows is the wrong approach and you have to override localText.MuiTablePagination.labelDisplayedRows(from, to, count)

@DanailH
Copy link
Member

DanailH commented May 23, 2022

@jorjen I apologize for misleading you. @StephenStrickland is correct, that's the way to go if you want to overite that text. I overlooked that you wanted to overwrite the text in the pagination component itself. Because the pagination we use is the core component TablePagination you would need to overwrite it using localText.MuiTablePagination.labelDisplayedRows(from, to, count)

To prevent this to happen again I will update the docs localization page with this example.

@DanailH DanailH self-assigned this May 23, 2022
@DanailH DanailH added the docs Improvements or additions to the documentation label May 23, 2022
@msassa
Copy link

msassa commented Jul 6, 2023

I think it's already fixed, but I managed to do it using this code in the localeText

    MuiTablePagination: {
        labelDisplayedRows: ({ from, to, count, page }) => {
            return `${from}-${to} de ${count}`;
        },
    },

Thanks

@JoshK2
Copy link

JoshK2 commented Jul 20, 2023

@jorjen I was running into a similar issue. Seems like the style of paging that we're wanting is currently a low priority item, see #409

I was able to get close to what I need with this example: https://stackblitz.com/edit/react-ujnaza?file=demo.tsx

It looks like localText.footerTotalVisibleRows is the wrong approach and you have to override localText.MuiTablePagination.labelDisplayedRows(from, to, count)

Thank you!

Copy link

⚠️ 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.

@jorjen: 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! docs Improvements or additions to the documentation support: question Community support but can be turned into an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants