Skip to content

Commit

Permalink
[DataGrid] Consider columnGroupHeaderHeight prop in `getTotalHeader…
Browse files Browse the repository at this point in the history
…Height` method (@k-rajat19) (#15927)

Co-authored-by: Rajat <[email protected]>
  • Loading branch information
KenanYusuf and k-rajat19 authored Dec 18, 2024
1 parent a035187 commit 2d9a3d3
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export function getTotalHeaderHeight(
apiRef: React.MutableRefObject<GridApiCommunity>,
props: Pick<
DataGridProcessedProps,
'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView'
'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView' | 'columnGroupHeaderHeight'
>,
) {
if (props.unstable_listView) {
Expand All @@ -454,9 +454,12 @@ export function getTotalHeaderHeight(
const isHeaderFilteringEnabled = gridHeaderFilteringEnabledSelector(apiRef);

const columnHeadersHeight = Math.floor(props.columnHeaderHeight * densityFactor);
const columnGroupHeadersHeight = Math.floor(
(props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor,
);
const filterHeadersHeight = isHeaderFilteringEnabled
? Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor)
: 0;

return columnHeadersHeight * (1 + (maxDepth ?? 0)) + filterHeadersHeight;
return columnHeadersHeight + columnGroupHeadersHeight * maxDepth + filterHeadersHeight;
}

0 comments on commit 2d9a3d3

Please sign in to comment.