Skip to content

Commit

Permalink
[enh] Activate the support for column resizing only if a column is re…
Browse files Browse the repository at this point in the history
…sizable

Signed-off-by: Stéphane Bégaudeau <[email protected]>
  • Loading branch information
sbegaudeau committed Dec 6, 2024
1 parent 7793d04 commit f2b45fd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ export const TableContent = memo(
manualPagination: serverSidePagination,
rowCount: table.paginationData.totalRowCount,
enableRowActions: true,
enableColumnResizing: true,
columnResizeMode: 'onEnd',
enableSorting: false,
onColumnSizingChange: setColumnSizing,
onColumnVisibilityChange: setColumnVisibility,
Expand Down Expand Up @@ -155,6 +153,12 @@ export const TableContent = memo(
};
}

const enableColumnResizing: boolean = table.columns.filter((column) => column.isResizable).length > 0;
if (enableColumnResizing) {
tableOptions.enableColumnResizing = enableColumnResizing;
tableOptions.columnResizeMode = 'onEnd';
}

const muiTable = useMaterialReactTable(tableOptions);
return (
<div>
Expand Down

0 comments on commit f2b45fd

Please sign in to comment.