-
-
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
[DataGridPro] Autosize Columns - Headers being cut off #10666
Conversation
…or columns Co-authored-by: seunexplicit <[email protected]>
Deploy preview: https://deploy-preview-10666--material-ui-x.netlify.app/ |
const iconContainer = header.querySelector(`.${gridClasses.iconButtonContainer}`); | ||
const menuContainer = header.querySelector(`.${gridClasses.menuIcon}`); | ||
const element = title ?? content; | ||
|
||
const style = window.getComputedStyle(header, null); | ||
const paddingWidth = parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10); | ||
const contentWidth = element.scrollWidth + 1; | ||
const width = paddingWidth + contentWidth; | ||
const width = | ||
contentWidth + | ||
paddingWidth + | ||
(iconContainer?.clientWidth ?? 0) + | ||
(menuContainer?.clientWidth ?? 0); |
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 think we'll have to differentiate the logic for desktop & mobile. We only keep the icons visible at all times on mobile, and we don't want to pay the width cost on desktop.
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.
@romgrk Apologies for the delay in resolving this.
The logic actually takes that into account already. Here is a loom video to confirm
Co-authored-by: seunexplicit <[email protected]>
Description
Screenshot
closes #10570
This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.