From 6d229603d2ece18c1c9fa693624276a5565ff198 Mon Sep 17 00:00:00 2001 From: mufazalov Date: Mon, 6 May 2024 12:07:03 +0300 Subject: [PATCH] fix: enable first column resize --- src/lib/DataTable.tsx | 2 +- src/lib/useTableResize.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/DataTable.tsx b/src/lib/DataTable.tsx index 02ddf2d..999bc78 100644 --- a/src/lib/DataTable.tsx +++ b/src/lib/DataTable.tsx @@ -321,7 +321,7 @@ class TableHead extends React.Component> { }; }; _getRenderedColumn = (index?: number) => { - if (index) { + if (index !== undefined) { return this.renderedColumns[index]; } return undefined; diff --git a/src/lib/useTableResize.ts b/src/lib/useTableResize.ts index 96ae144..5b51496 100644 --- a/src/lib/useTableResize.ts +++ b/src/lib/useTableResize.ts @@ -9,13 +9,12 @@ export type GetSavedColumnWidthByName = () => ColumnWidthByName; export function updateColumnsWidth( columns: Column[], columnsWidthSetup: ColumnWidthByName, - defaultResizeable = false, ): Column[] { return columns.map((column) => { let sub: Column[] | undefined; if (column.sub) { - sub = updateColumnsWidth(column.sub, columnsWidthSetup, defaultResizeable); + sub = updateColumnsWidth(column.sub, columnsWidthSetup); } const newWidth = columnsWidthSetup[column.name] ?? column.width;