Skip to content

Commit

Permalink
ensure setColumnLayout function applies all keys
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Jan 21, 2024
1 parent 3bf5438 commit 4858ad5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16525,7 +16525,7 @@ class Persistence extends Module{
}

setColumnLayout(layout){
this.table.columnManager.setColumns(this.mergeDefinition(this.table.options.columns, layout));
this.table.columnManager.setColumns(this.mergeDefinition(this.table.options.columns, layout, true));
return true;
}

Expand Down Expand Up @@ -16591,7 +16591,7 @@ class Persistence extends Module{
}

//merge old and new column definitions
mergeDefinition(oldCols, newCols){
mergeDefinition(oldCols, newCols, mergeAllNew){
var output = [];

newCols = newCols || [];
Expand All @@ -16601,7 +16601,9 @@ class Persistence extends Module{
keys;

if(from){
if(this.config.columns === true || this.config.columns == undefined){
if(mergeAllNew){
keys = Object.keys(column);
}else if(this.config.columns === true || this.config.columns == undefined){
keys = Object.keys(from);
keys.push("width");
}else {
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/js/modules/Persistence/Persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Persistence extends Module{
}

setColumnLayout(layout){
this.table.columnManager.setColumns(this.mergeDefinition(this.table.options.columns, layout));
this.table.columnManager.setColumns(this.mergeDefinition(this.table.options.columns, layout, true));
return true;
}

Expand Down Expand Up @@ -267,7 +267,7 @@ class Persistence extends Module{
}

//merge old and new column definitions
mergeDefinition(oldCols, newCols){
mergeDefinition(oldCols, newCols, mergeAllNew){
var output = [];

newCols = newCols || [];
Expand All @@ -277,7 +277,9 @@ class Persistence extends Module{
keys;

if(from){
if(this.config.columns === true || this.config.columns == undefined){
if(mergeAllNew){
keys = Object.keys(column);
}else if(this.config.columns === true || this.config.columns == undefined){
keys = Object.keys(from);
keys.push("width");
}else{
Expand Down

0 comments on commit 4858ad5

Please sign in to comment.