-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] autoHeight mode that fills the available height of the viewport #5451
Comments
By default, the grid fits into the dimensions of its parent container. That being said, if the parent container fills the entire screen, the grid should follow it too. I didn't understand why this is not working for you. Could you provide a reproduction? I created a demo to show how to make the grid fill the screen: https://codesandbox.io/s/datagridprodemo-demo-mui-x-forked-z9n1vm?file=/demo.tsx Note that any element between |
Duplicates
Latest version
Summary 💡
I would like to request an
autoHeight
mode, that automatically uses the available remaining height of the viewport and resizes theDataGridPro
component to that value. The intended effect is, that no matter how the actual size of the viewport,DataGridPro
fills it entirely, also reacting to resizing.Examples 🌈
And this would lead to something like the following (sorry for the heavy redactions, but the data is unimportant and this is from an internal tool):
DataGridPro
componentFor reference: currently I am doing something like the following.
_max-height-box.tsx
MyDataGridUser.tsx
Motivation 🔦
I have a
DataGridPro
that has a limited amount of elements, which doesn't want any pagination – all rows should always be available.DataGridPro
has the property of pinning the head column row and adding scrolling, when it is placed within an element with a fixed height (side note:autoHeight
disables the pinning, which is rather unfortunate). Since I do know how much space I will have on a user's screen or they might resize the window, I now have a custom<Box>
wrapper, that listens toresize
and always sets theheight
to the maximum available. That way I do get the scrolling ofDataGridPro
, the pinned header row and an responsiveDataGridPro
.The motivation therefore is to get rid of this custom wrapper and have a mode for
DataGridPro
that automatically fills the whole available height and width (or whatever limit is passed to theDataGridPro
component).Side notes:
DataGridPro
wouldn't contract or expand properly, but get stuck on their last size.flex
yielded a two pixel heightDataGridPro
component, that didn't expand after loading the data from the server.Order ID 💳 (optional)
47016
The text was updated successfully, but these errors were encountered: