Skip to content

Commit

Permalink
when using columnCalcs in true mode, ensure calc rows are regenerated…
Browse files Browse the repository at this point in the history
… after groupRows cleared
  • Loading branch information
olifolkerd committed Oct 16, 2022
1 parent fb5f05f commit eec3b6f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
14 changes: 14 additions & 0 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3830,6 +3830,16 @@ class ColumnCalcs extends Module{
}
}

reinitializeCalcs(){
if(this.topCalcs.length){
this.initializeTopRow();
}

if(this.botCalcs.length){
this.initializeBottomRow();
}
}

initializeTopRow(){
if(!this.topInitialized){
this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
Expand Down Expand Up @@ -12001,6 +12011,10 @@ class GroupRows extends Module{
}

this.configureGroupSetup();

if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
this.table.modules.columnCalcs.reinitializeCalcs();
}

this.refreshData();

Expand Down
2 changes: 1 addition & 1 deletion dist/js/tabulator_esm.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/js/modules/ColumnCalcs/ColumnCalcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ class ColumnCalcs extends Module{
}
}

reinitializeCalcs(){
if(this.topCalcs.length){
this.initializeTopRow();
}

if(this.botCalcs.length){
this.initializeBottomRow();
}
}

initializeTopRow(){
if(!this.topInitialized){
this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
Expand Down
4 changes: 4 additions & 0 deletions src/js/modules/GroupRows/GroupRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ class GroupRows extends Module{
}

this.configureGroupSetup();

if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
this.table.modules.columnCalcs.reinitializeCalcs();
}

this.refreshData();

Expand Down

0 comments on commit eec3b6f

Please sign in to comment.