Skip to content

Commit

Permalink
hide popups when a table is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed May 26, 2022
1 parent 32c3843 commit dd2974c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dist/js/tabulator_esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class Popup extends CoreFeature{

this.blurEvent = this.hide.bind(this, false);
this.escEvent = this._escapeCheck.bind(this);

this.destroyBinding = this.hide.bind(this, true);
}

_lookupContainer(){
Expand Down Expand Up @@ -311,6 +313,8 @@ class Popup extends CoreFeature{
this._fitToScreen(x, y, parentEl, parentOffset, position);

this.visible = true;

this.subscribe("table-destroy", this.destroyBinding);

return this;
}
Expand Down Expand Up @@ -406,6 +410,8 @@ class Popup extends CoreFeature{
if(this.blurCallback && !silent){
this.blurCallback();
}

this.unsubscribe("table-destroy", this.destroyBinding);
}

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

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/js/core/tools/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default class Popup extends CoreFeature{

this.blurEvent = this.hide.bind(this, false);
this.escEvent = this._escapeCheck.bind(this);

this.destroyBinding = this.hide.bind(this, true);
}

_lookupContainer(){
Expand Down Expand Up @@ -139,6 +141,8 @@ export default class Popup extends CoreFeature{
this._fitToScreen(x, y, parentEl, parentOffset, position);

this.visible = true;

this.subscribe("table-destroy", this.destroyBinding);

return this;
}
Expand Down Expand Up @@ -234,6 +238,8 @@ export default class Popup extends CoreFeature{
if(this.blurCallback && !silent){
this.blurCallback();
}

this.unsubscribe("table-destroy", this.destroyBinding);
}

return this;
Expand Down

0 comments on commit dd2974c

Please sign in to comment.