-
-
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] No rows overlay overlaps with the header #3229
Comments
So me this problem was not introduced recently. |
The virtualization have a behavior to save some space when there is no rows and |
My workaround 'til for now is:
I know that it's not clean, but... |
Do you have the issue on the last version of the DataGrid or a you stuck in a previous version ? |
Where do you export it from? I'm using Data-grid-pro and same problem, can't find |
@MBilalShafi I let you that one 👍 |
Did this perhaps come back? I'm seeing a zero height overlay on the latest version. The workaround above works. |
But hold on. Let me try to reproduce it in the sandbox first. |
Okay, I figured out that a parent Stack component wasn't set to flex grow, so the DataGrid doesn't grow. Is this expected, or should the DataGrid grow to a min-height to accommodate the NoRowsOverlay component? Here's a code sandbox. If you set the parent Stack to flex={1}, the overlay appears. |
I'm using @mui/x-data-grid and found a solution, though it's not clean.
|
This has to be a bug. When the data grid is loaded with no rows, the thing collapses. When rows are added it expands for them, and when they are removed it appears to stay expanded. But forget about that second behavior, can it at least have a min-height of 1 row when it is given |
The official MUI documentation explains how to customize the overlay height here. This solution was working perfectly in previous versions, but after updating to the latest version (7.22.0), the The workaround is to give styleOverrides: {
root: {
'--DataGrid-overlayHeight': '350px',
},
virtualScrollerContent: {
minHeight: 'var(--DataGrid-overlayHeight)',
},
overlayWrapper: {
position: 'absolute',
height: 'auto',
},
} |
Duplicates
Latest version
Current behavior 😯
This overlapping happens in two scenarios:
Scenario 1
<DataGridPro rows={rows} columns={columns} autoHeight />
.MuiDataGrid-overlay
hasheight: 0px
Screenshot 1 :
Screenshot 2:
Scenario 2
<DataGridPro rows={rows} columns={columns} />
Screenshot 1:
The reason why I show these as two different scenarios is because it seems that what happens to work fine for one scenario, does not work fine for the other scenario in a particular environment and vice versa.
Expected behavior 🤔
No rows should take up
height: auto;
and be vertically centered and appear within.MuiDataGrid-virtualScrollerContent
Steps to reproduce 🕹
Scenario 1
Steps:
<DataGridPro>
component withautoHeight
prop and show it without rows so the default NoRowsOverlay could appearScenario 2
https://codesandbox.io/s/datagridpro-v5-no-rows-ogh17
Context 🔦
It is obvious here since it looks broken, I am trying to have No rows not overlapping the header and be centered inside the DataGrid body.
Your environment 🌎
Scenario 1
`npx @mui/envinfo`
Dependencies:
Order ID 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: