From b9a03fc4124d2a3cf7a5ea992336cc75a4d0cf56 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Wed, 28 Dec 2022 00:41:34 -0800 Subject: [PATCH] Add persisted width on colDef generator --- src/renderer/components/virtual-table/index.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/virtual-table/index.tsx b/src/renderer/components/virtual-table/index.tsx index 53672073..f513fd61 100644 --- a/src/renderer/components/virtual-table/index.tsx +++ b/src/renderer/components/virtual-table/index.tsx @@ -217,10 +217,15 @@ export const getColumnDef = (column: TableColumn) => { }; export const getColumnDefs = (columns: PersistedTableColumn[]) => { - const columnDefs: any[] = []; + const columnDefs: ColDef[] = []; for (const column of columns) { - const columnExists = tableColumns[column.column as keyof typeof tableColumns]; - if (columnExists) columnDefs.push(columnExists); + const presetColumn = tableColumns[column.column as keyof typeof tableColumns]; + if (presetColumn) { + columnDefs.push({ + ...presetColumn, + width: column.width, + }); + } } return columnDefs;