Skip to content

Commit

Permalink
[DataGrid] Fix overlay height in autoHeight mode (#15201)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii authored Oct 31, 2024
1 parent c75774c commit 3ed65dc
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function CustomNoRowsOverlay() {
);
}

export default function AutoHeightOverlayNoSnap() {
export default function AutoHeightOverlay() {
return (
<Box sx={{ width: '100%' }}>
<DataGrid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function CustomNoRowsOverlay() {
);
}

export default function AutoHeightOverlayNoSnap() {
export default function AutoHeightOverlay() {
return (
<Box sx={{ width: '100%' }}>
<DataGrid
Expand Down
2 changes: 1 addition & 1 deletion docs/data/data-grid/layout/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ take the height of two rows by default.

To customize the overlay height, use the `--DataGrid-overlayHeight` CSS variable.

{{"demo": "AutoHeightOverlayNoSnap.js", "bg": "inline"}}
{{"demo": "AutoHeightOverlay.js", "bg": "inline"}}

## API

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export const useGridVirtualScroller = () => {
};

if (rootProps.autoHeight && currentPage.rows.length === 0) {
size.height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
size.flexBasis = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
}

return size;
Expand Down

0 comments on commit 3ed65dc

Please sign in to comment.