-
-
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
[data grid] Error with useResizeContainer
: The parent DOM element of the data grid has an empty height
#14811
Comments
To help us diagnose the issue efficiently, could you provide a stripped-down reproduction test case using the latest version? A live example would be fantastic! ✨ For your convenience, our documentation offers templates and guides on creating targeted examples: Support - Bug reproduction Just a friendly reminder: clean, functional code with minimal dependencies is most helpful. Complex code can make it tougher to pinpoint the exact issue. Sometimes, simply going through the process of creating a minimal reproduction can even clarify the problem itself! Thanks for your understanding! 🙇🏼 |
useResizeContainer
: The parent DOM element of the data grid has an empty height.
Thanks for your reply but I can't provide you live example. As I already shared the code snippet which I am using in my project. what else do you want me to provide, please explain? |
The code example you shared is not enough to pin down the problem you face. So we need a minimal reproduction where we can see how you implemented the grid. From the error code alone it looks like your container has no height (even setting 'height' can lead to 0 height when in the wrong place) and the grid needs this to calculate various things. So if you cannot provide this we unfortunately cannot really help you. |
@michelengelen @zenazn Please look into the below code. import React, { memo, useEffect, useRef, useState } from "react"; import { ROW_PER_PAGE_OPTION } from "../../../appConstants"; interface ColumnFilter { const CenteredOverlay = styled(GridOverlay) import Pagination from "./pagination/Pagination"; type TableComponentProps = { const TableComponent = ({ useEffect(() => { const [sortModel, setSortModel] = useState([ const handleSortModelChange = (model) => {
}; //to be fixed when delete functionality works const CustomColumnMenu = (props: GridColumnMenuProps) => { const getRowId = (row) => { return ( export default memo(TableComponent); and Code for CSS file is :-- .table__head { .table__paper-wrapper { .table__display-flex { .table__display-flex-center { .table__display-flex-right { .table__sort-down { .table__sort-icon { .table__column-option-icon { .table__column__divider { .table__body { .table__header-cell { .table__cell { .table__last-cell { .datagrid-table { |
@michelengelen Please help me, My team stucked in this error from last 2 weeks. |
@shikha-mobibiz Please don't share code inline. If you need to share code, share a codesandbox. If you don't know how to do that, read this: https://mui.com/x/introduction/support/#bug-reproductions As for your issue, it looks like you're not wrapping the grid with a container with explicit dimensions like the docs requires you to do: https://mui.com/x/react-data-grid/layout/ |
@romgrk Ok Thanks for your reply. Ok I will share the codesandbox link. Actually problem is my application consists MicroFrontend Architecture and SDK. will try to add code of Table. |
@romgrk No, Actually I have tried static height also, as MUI suggested in the docs, but still same error. import React, { memo, useEffect, useRef, useState } from "react"; import { ROW_PER_PAGE_OPTION } from "../../../appConstants"; interface ColumnFilter { const CenteredOverlay = styled(GridOverlay) import Pagination from "./pagination/Pagination"; type TableComponentProps = { const TableComponent = ({ useEffect(() => { const [sortModel, setSortModel] = useState([ const handleSortModelChange = (model) => {
}; //to be fixed when delete functionality works const CustomColumnMenu = (props: GridColumnMenuProps) => { const getRowId = (row) => { return ( export default memo(TableComponent); |
As mentioned from @romgrk please don't share code inline ... it's noisy and hard to read. If a codesandbox does not suit your implementation or it's hard to show there please create an example repository which we can check out and run locally. I know users have done this in the past for microfrontends as well, so it does work. |
Sure Thanks @michelengelen. This is against the policy to share the code but I will try to add minimal files to replicate the issue and share with you on tomorrow. Meanwhile I am sharing attachment to show I have set Height and width on parent of Data Grid and showing error also. I have checked some open/closed bugs also, this issue is quite frustrated and faced by many developers even after added height/width. |
We can't debug an issue until we have a reproduction case, I'll wait for you to provide an update in a codesandbox. |
useResizeContainer
: The parent DOM element of the data grid has an empty height.useResizeContainer
: The parent DOM element of the data grid has an empty height
@romgrk I will share the code of Micro Frontend architecture by Today. Thanks for helping. |
The issue has been inactive for 7 days and has been automatically closed. |
Steps to reproduce
Link to live example: (required)
Steps:
Please make sure that this element has an intrinsic height.
The grid displays with a height of 0px.
More details: https://mui.com/r/x-data-grid-no-dimensions.
index.js:408 MUI X: useResizeContainer - The parent DOM element of the data grid has an empty width.
Please make sure that this element has an intrinsic width.
The grid displays with a width of 0px.
More details: https://mui.com/r/x-data-grid-no-dimensions.
Below is the code snippet, we have tried to fix by adding height and width on Paper and div as well .
<Paper
className={styles["table__paper-wrapper"]}
data-testid="paper"
style={{ height: "400px" }}
Please help me on this.
Current behavior
Grid renders properly with mentioned console errors.
"@mui/x-data-grid": "^7.6.2",
Expected behavior
Grid should render without console errors.
"@mui/x-data-grid": "^7.6.2",
Context
No response
Your environment
npx @mui/envinfo
Search keywords: useResizeContainer, parent DOM, zero height
The text was updated successfully, but these errors were encountered: