Skip to content

Commit

Permalink
fix: enable first column resize (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemmufazalov committed May 6, 2024
1 parent 040c7cc commit 659541d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class TableHead<T> extends React.Component<TableHeadProps<T>> {
};
};
_getRenderedColumn = (index?: number) => {
if (index) {
if (index !== undefined) {
return this.renderedColumns[index];
}
return undefined;
Expand Down
3 changes: 1 addition & 2 deletions src/lib/useTableResize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ export type GetSavedColumnWidthByName = () => ColumnWidthByName;
export function updateColumnsWidth<T>(
columns: Column<T>[],
columnsWidthSetup: ColumnWidthByName,
defaultResizeable = false,
): Column<T>[] {
return columns.map((column) => {
let sub: Column<T>[] | undefined;

if (column.sub) {
sub = updateColumnsWidth(column.sub, columnsWidthSetup, defaultResizeable);
sub = updateColumnsWidth(column.sub, columnsWidthSetup);
}

const newWidth = columnsWidthSetup[column.name] ?? column.width;
Expand Down

0 comments on commit 659541d

Please sign in to comment.