Skip to content

Commit

Permalink
Fixed #486 - The setColumnWidth function doesn't decrease a column width
Browse files Browse the repository at this point in the history
  • Loading branch information
tsv2013 committed Oct 30, 2024
1 parent d51e32a commit 1a43438
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/tables/tabulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface ITabulatorOptions extends ITableOptions {
tabulatorOptions?: any;
downloadHiddenColumns?: boolean;
actionsColumnWidth?: number;
columnMinWidth?: number;
downloadButtons?: Array<string>;
downloadOptions?: { [type: string]: any };
/*
Expand Down Expand Up @@ -54,6 +55,7 @@ export const defaultDownloadOptions = {
export const defaultOptions: ITabulatorOptions = {
tabulatorOptions: {},
actionsColumnWidth: 60,
columnMinWidth: 248,
downloadHiddenColumns: false,
downloadButtons: ["csv"],
downloadOptions: defaultDownloadOptions,
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 1a43438

Please sign in to comment.