Skip to content

Commit b009d0a

Browse files
committed
✨Enhance column resizing behavior for closed columns
1 parent b63bbd0 commit b009d0a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

package/DataTableResizableHeaderHandle.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ export const DataTableResizableHeaderHandle = (props: DataTableResizableHeaderHa
3838

3939
columnRef.current.style.width = widthString;
4040

41+
// Get the next th (if it exists)
42+
const nextColumnElement = columnRef.current.nextElementSibling as HTMLTableCellElement | null;
43+
44+
if (nextColumnElement) {
45+
const nextColumnWidth = nextColumnElement.getBoundingClientRect().width - delta;
46+
const nextColumnWidthString = `${nextColumnWidth}px`;
47+
nextColumnElement.style.width = nextColumnWidthString;
48+
}
49+
4150
// we have to set (store) the width in the context and in the
4251
// local storage, otherwise the resizing won't work for small sizes
4352
setColumnWidth(accessor, columnRef.current.style.width as string);

0 commit comments

Comments
 (0)