-
-
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
How can I stop the DataGrid from expanding horizontally to fill its parent container? #10472
Comments
Hey @RyleySill93 ... I'll have a look and come back with a recipe! 👍🏼 |
If I am relating to it correctly, we used to have a prop called By the way, I am just curious, if not an empty cell, what exactly do you want to see in the empty space, do you want to place another element there? If that is the case, wouldn't it be better to reduce the width of the grid and place the element outside? 🤔 |
Yes, I remembered using that prop in the past as well. That's why I thought I can come up with a quick recipe ... I did not know that it got removed though. The DataGrid in itself is not using intrinsic dimensions (Docs - DataGrid Layout), so depending on your specific use-case this can potentially be hard to accomplish. As @MBilalShafi already mentioned: If you can outline what you want to accomplish its easier for us to help you out! |
@RyleySill93 One problem with that approach is that it wouldn't be possible to virtualize columns. Maybe one thing you could try is to make that last edit: Though the empty cells would still be interactive, IIUC. Not sure how to disable keyboard & mouse actions for those. I guess |
The issue has been inactive for 7 days and has been automatically closed. If you think that it has been incorrectly closed, please reopen it and provide missing information (if any) or continue the last discussion. |
The problem in depth 🔍
How can I stop the DataGrid from expanding horizontally to fill its parent container?
The default behavior appears to insert additional cells in a ghost column which expand to fill the parent container. Is there a way to make it behave more like a table so it only takes up the horizontal space needed to render the columns?
Your environment 🌎
`npx @mui/envinfo`
Search keywords: Data Grid Width
Order ID: 72462
The text was updated successfully, but these errors were encountered: