Skip to content

Commit 931b8dd

Browse files
committed
Fix issue with problematically long column names
1 parent 43b3e99 commit 931b8dd

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

packages/components/src/internal/components/base/Grid.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,15 @@ export class GridHeader extends PureComponent<GridHeaderProps, State> {
193193
onDrop={this.handleDrop}
194194
title={hideTooltip ? undefined : description}
195195
>
196-
{headerCell ? headerCell(column, i, columns.size) : title}
197-
{/* headerCell will render the helpTip, so only render here if not using headerCell() */}
198-
{!headerCell && column.helpTipRenderer && (
199-
<LabelHelpTip popoverClassName="label-help-arrow-top" title={title}>
200-
<HelpTipRenderer type={column.helpTipRenderer} />
201-
</LabelHelpTip>
196+
{headerCell && headerCell(column, i, columns.size)}
197+
{!headerCell && (
198+
<div className={GRID_HEADER_CELL_BODY}>
199+
{title}
200+
{/* headerCell will render the helpTip, so only render here if not using headerCell() */}
201+
<LabelHelpTip popoverClassName="label-help-arrow-top" title={title}>
202+
<HelpTipRenderer type={column.helpTipRenderer} />
203+
</LabelHelpTip>
204+
</div>
202205
)}
203206
</th>
204207
);

packages/components/src/internal/components/editable/EditableGrid.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
CELL_SELECTION_HANDLE_CLASSNAME,
2828
GRID_CHECKBOX_OPTIONS,
2929
GRID_EDIT_INDEX,
30+
GRID_HEADER_CELL_BODY,
3031
GRID_SELECTION_INDEX,
3132
MAX_EDITABLE_GRID_ROWS,
3233
} from '../../constants';
@@ -884,7 +885,7 @@ export class EditableGrid extends PureComponent<EditableGridProps, EditableGridS
884885

885886
// TODO should be able to just use LabelOverlay here since it can handle an alternate tooltip renderer
886887
return (
887-
<>
888+
<div className={GRID_HEADER_CELL_BODY}>
888889
{!showLabelOverlay && (
889890
<>
890891
{label}
@@ -909,7 +910,7 @@ export class EditableGrid extends PureComponent<EditableGridProps, EditableGridS
909910
<RemoveColumnMenuItem column={qColumn} onClick={metadata.onRemoveColumn} />
910911
</DropdownMenu>
911912
)}
912-
</>
913+
</div>
913914
);
914915
};
915916

packages/components/src/theme/grid.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
}
4747

4848
.grid-header-cell {
49-
position: relative;
50-
padding: 0 9px;
51-
font-weight: bold;
52-
vertical-align: top !important; // important because bootstrap has a highly specific selector that sets it to bottom
49+
position: relative;
50+
padding: 0 9px;
51+
font-weight: bold;
52+
vertical-align: top !important; // important because bootstrap has a highly specific selector that sets it to bottom
5353

5454
input:not([type=checkbox]) {
5555
width: 100%
@@ -59,6 +59,11 @@
5959
.grid-header-cell__body {
6060
display: flex;
6161
gap: 8px;
62+
// Note: we have to have max-height and overflow-y set because some grid configurations can lead to extremely tall
63+
// table headers that take up 100% of the table height, completely blocking the table rows. To repro add a column
64+
// with a really long name (at or near the max length of 200 chars) and keep all values blank.
65+
max-height: 250px;
66+
overflow-y: auto;
6267
}
6368

6469
.grid-header-cell__title-wrapper {

0 commit comments

Comments
 (0)