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

[DataGrid] Add minWidth to GridColDef #2101

Merged

Conversation

DanailH
Copy link
Member

@DanailH DanailH commented Jul 8, 2021

Fixes #1850

A follow up on this PR -> #1954

The minWidth also works in combination with the column resize feature as in if minWidth is provided the resizing will be restricted and the width of the column cannot be smaller than the set minWidth.

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

@DanailH DanailH added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request labels Jul 8, 2021
@DanailH DanailH requested a review from a team July 8, 2021 12:00
@DanailH DanailH self-assigned this Jul 8, 2021
@DanailH DanailH changed the title Add minWidth to GridColDef [DataGrid] Add minWidth to GridColDef Jul 8, 2021
@flaviendelangle
Copy link
Member

We should probably update the Resizing documentation with a line describing the minWidth (and in the future the maxWidth) impact on the resize.

And add a minWidth to one of the two resizable columns of the doc example.

Copy link
Member

@oliviertassinari oliviertassinari left a 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.

DanailH and others added 6 commits July 9, 2021 15:01
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,
Copy link
Member

@m4theushw m4theushw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanailH DanailH requested a review from m4theushw July 20, 2021 08:20
@DanailH
Copy link
Member Author

DanailH commented Jul 20, 2021

Ok, I approved argos - it was complaining because of the 50px minWidth. It would be great if I can merge it 😅

Copy link
Member

@oliviertassinari oliviertassinari left a 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 👍

docs/src/pages/components/data-grid/columns/columns.md Outdated Show resolved Hide resolved
docs/src/pages/components/data-grid/columns/columns.md Outdated Show resolved Hide resolved
@DanailH
Copy link
Member Author

DanailH commented Jul 20, 2021

Created a follow up ticket for maxWidth -> #2174

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! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] Introduces minWidth in ColDef for columns with fluid width
5 participants