-
-
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
[data grid] Format row count numbers in pagination #13222
Comments
Probably already possible with a custom pagination and the TablePagination component ... the prop But this seems like a very heavy customization for such a little thing! @mui/xgrid WDYT? |
Looking at the code, it seems that you have a This would be nice to have an example if it does work |
Oh yes, that actually works! FYI: numbers were artificially created to test this ( Thanks @flaviendelangle for this tip! 👍🏼 slotProps={{
pagination: { labelDisplayedRows: ({ from, to, count }) => `${from.toLocaleString('en')}-${to.toLocaleString('en')}`},
}} |
@Janpot: 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. |
@michelengelen do you think it would justify a doc example? |
Probably ... its not easy to find that feature otherwise I'll reopen and add it to the recipe umbrella! |
It would be nice to have some kind of API pages for the slots, but that's a big initiative and not specific to this prop in particular. |
Respecting the decision ofcourse but gonna play a bit advocate of the devil here. To me it seems strange that the |
Related issues #7457 |
Right, SSR, good concern 👍 |
Yeah, I forget that one every time 😆 |
🤔 Actually, if the texts are already localized, why can't the localization of the numbers follow the text? If there is an actual SSR problem, shouldn't it then be already present in the current localization of the texts? |
This looks like a sub-issue of the parent one: mui/material-ui#24495. I proposed a possible solution a while back: mui/material-ui#24495 (comment). Side observations:
I would expect: `${visibleCount.toLocaleString('fr-FR')} sur ${totalCount.toLocaleString('fr-FR')}`, e.g. if Pennylane adopts our data grid, it will be wrong. My default OS language is English (so what |
Summary
Live demo https://stackblitz.com/edit/react-jxqb4n?file=Demo.tsx
The pagination control looks like:
Would it be possible to format these numbers? A thousands separator would make them more readable. In practice this is mostly going to be interesting for the total count, but once you start formatting, you may as well do it for all of these numbers.
Examples
Motivation
No response
Search keywords: pagination format number
The text was updated successfully, but these errors were encountered: