Skip to content

Commit

Permalink
issue-15266
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rajat19 committed Nov 6, 2024
1 parent 565de78 commit 62a64cd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,22 @@ function extractColumnWidths(
const header = findGridHeader(apiRef.current, column.field);
if (header) {
const title = header.querySelector(`.${gridClasses.columnHeaderTitle}`);
const titleContainer = header.querySelector(`.${gridClasses.columnHeaderTitleContainer}`)!;
const content = header.querySelector(`.${gridClasses.columnHeaderTitleContainerContent}`)!;
const iconContainer = header.querySelector(`.${gridClasses.iconButtonContainer}`);
const menuContainer = header.querySelector(`.${gridClasses.menuIcon}`);
const element = title ?? content;

const style = window.getComputedStyle(header, null);
const titleContainerStyle = window.getComputedStyle(titleContainer, null);
const paddingWidth = parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
const flexGap = iconContainer ? parseInt(titleContainerStyle.gap, 10) : 0;
const contentWidth = element.scrollWidth + 1;
const width =
contentWidth +
paddingWidth +
(iconContainer?.clientWidth ?? 0) +
(menuContainer?.clientWidth ?? 0);
(menuContainer?.clientWidth ?? 0) +
flexGap;

filteredWidths.push(width);
}
Expand Down

0 comments on commit 62a64cd

Please sign in to comment.