-
-
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] Show Column Name in Menu Icon if Header is Too Small #16971
base: master
Are you sure you want to change the base?
Conversation
Thanks for adding a type label to the PR! 👍 |
Deploy preview: https://deploy-preview-16971--material-ui-x.netlify.app/ |
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 dont have a clean solution for the mentioned case, but it should be something we need to take into consideration!
const neededWidth = | ||
divRef.current?.parentElement?.firstElementChild?.firstElementChild?.firstElementChild | ||
?.scrollWidth ?? 1; |
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.
this can break with custom header renderers, where the first element isn't necessarily a text block, or there are follow-up elements like in the docs example: Custom header renderer
I would like to take a look at the issue of overflowing column headers more holistically, but haven't found the time yet. I don't think we should merge this until we have considered other options. |
The main reason for this quick fix is that I use it in a data grid with lots of one- or two-digit columns that have long names. And since there’s no hover, it’s not ideal — especially because the users aren’t the best in this use case :) I don’t think it will actually break anything. But of course, any more complex solution is more than welcome. Let me know if I can help. |
If the column header width is too small, causing the column title to be hidden when hovering over the menu, display the column name as the menu icon’s title.
Before:

After:
