Skip to content

Commit d2f9fde

Browse files
fix:Enable Column Width Resizing for Merged Header Cells #446
1 parent c981381 commit d2f9fde

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/lib/Behaviors/DefaultBehavior.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
handleDoubleClick,
77
getScrollOfScrollableElement,
88
isSelectionKey,
9+
getCompatibleCellAndTemplate,
910
} from "../../core";
1011
import {
1112
KeyboardEvent,
@@ -49,6 +50,8 @@ export class DefaultBehavior extends Behavior {
4950
location: PointerLocation,
5051
state: State
5152
): Behavior {
53+
const { cell } = getCompatibleCellAndTemplate(state, location);
54+
5255
// changing behavior will disable all keyboard event handlers
5356
const target = event.target as HTMLDivElement;
5457
if (
@@ -57,7 +60,7 @@ export class DefaultBehavior extends Behavior {
5760
(event.pointerType === "touch" &&
5861
(target.className === "rg-touch-resize-handle" ||
5962
target.className === "rg-resize-handle"))) &&
60-
location.row.idx === 0 &&
63+
(location.row.idx === 0 || cell.type === "header") &&
6164
location.column.resizable &&
6265
location.cellX >
6366
location.column.width -

src/lib/Components/CellRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const CellRenderer: React.FC<CellRendererProps> = ({
134134
})}
135135
>
136136
{cellTemplate.render(cellToRender, isMobile ? isInEditMode : false, onCellChanged)}
137-
{location.row.idx === 0 && location.column.resizable && <ResizeHandle />}
137+
{(location.row.idx === 0 || cell.type === 'header')&& location.column.resizable && <ResizeHandle />}
138138
{state.enableGroupIdRender && cell?.groupId !== undefined && !(isInEditMode && isMobile) && (
139139
<span className="rg-groupId">{cell.groupId}</span>
140140
)}

0 commit comments

Comments
 (0)