-
-
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] Add minWidth
to GridColDef
#2101
[DataGrid] Add minWidth
to GridColDef
#2101
Conversation
minWidth
to GridColDef
minWidth
to GridColDef
We should probably update the And add a |
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.
A test case where the new logic doesn't work https://codesandbox.io/s/material-demo-forked-hkgdo?file=/demo.js. There is enough space not to have a scrollbar, and yet we display one.
packages/grid/_modules_/grid/components/columnHeaders/GridColumnHeaderItem.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
….com:DanailH/material-ui-x into feature/DataGrid-1850-add-minWidth-in-ColDef :Please enter a commit message to explain why this merge is necessary,
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.
Open https://codesandbox.io/s/material-demo-forked-8soge?file=/demo.js and note that the age column is hidden. I think we forgot to consider minWidth
when computing the available viewport width:
packages/grid/_modules_/grid/hooks/features/columns/useGridColumns.ts
Outdated
Show resolved
Hide resolved
Ok, I approved argos - it was complaining because of the |
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.
Great to not have the logic leak outside of the two relevant hooks 👍
Created a follow up ticket for |
Fixes #1850
A follow up on this PR -> #1954
The
minWidth
also works in combination with the column resize feature as in ifminWidth
is provided the resizing will be restricted and the width of the column cannot be smaller than the setminWidth
.I used the same example, with just a small tweak.
Preview: https://deploy-preview-2101--material-ui-x.netlify.app/components/data-grid/columns/#minimum-width