From 1a43438768e21baac753b9281182f2c284781ab9 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Wed, 30 Oct 2024 09:54:37 +0300 Subject: [PATCH] Fixed #486 - The setColumnWidth function doesn't decrease a column width --- src/tables/tabulator.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tables/tabulator.ts b/src/tables/tabulator.ts index 7a6924a1..7da319e8 100755 --- a/src/tables/tabulator.ts +++ b/src/tables/tabulator.ts @@ -20,6 +20,7 @@ interface ITabulatorOptions extends ITableOptions { tabulatorOptions?: any; downloadHiddenColumns?: boolean; actionsColumnWidth?: number; + columnMinWidth?: number; downloadButtons?: Array; downloadOptions?: { [type: string]: any }; /* @@ -54,6 +55,7 @@ export const defaultDownloadOptions = { export const defaultOptions: ITabulatorOptions = { tabulatorOptions: {}, actionsColumnWidth: 60, + columnMinWidth: 248, downloadHiddenColumns: false, downloadButtons: ["csv"], downloadOptions: defaultDownloadOptions, @@ -145,7 +147,7 @@ export class Tabulator extends Table { tooltipsHeader: true, tooltips: (cell: any) => cell.getValue(), downloadRowRange: "all", - columnMinWidth: 248, + columnMinWidth: (this.options as ITabulatorOptions).columnMinWidth, paginationButtonCount: 3, nestedFieldSeparator: false, }, @@ -383,12 +385,10 @@ export class Tabulator extends Table { public setColumnWidth(columnName: string, width: number | string): void { super.setColumnWidth(columnName, width); if (this.isRendered) { - var definition = this.tabulatorTables - .getColumn(columnName) - .getDefinition(); - definition.width = width; - definition.widthShrink = 0; - this.layout(); + const column = this.tabulatorTables.getColumn(columnName); + if(!!column) { + column.setWidth(width); + } } }