Skip to content

Commit

Permalink
Fix: check if popup close event is relevant (fixes #160) (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-steele authored Jan 27, 2025
1 parent ed04d61 commit 676f12c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions js/HotgridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ class HotgridView extends ComponentView {
this.setUpViewData();
}

remove() {
this.removePopupClosedListener();
super.remove();
}

removePopupClosedListener() {
this.stopListening(Adapt, 'notify:closed', this.onPopupClosed);
}

setUpViewData() {
this.popupView = null;
this._isPopupOpen = false;
Expand Down Expand Up @@ -45,19 +54,21 @@ class HotgridView extends ComponentView {
model: this.model
});

notify.popup({
this.notifyView = notify.popup({
_view: this.popupView,
_isCancellable: true,
_showCloseButton: false,
_classes: 'hotgrid ' + this.model.get('_classes')
});

this.listenToOnce(Adapt, {
'popup:closed': this.onPopupClosed
this.listenTo(Adapt, {
'notify:closed': this.onPopupClosed
});
}

onPopupClosed() {
onPopupClosed(view) {
if (view !== this.notifyView) return;
this.removePopupClosedListener();
this.model.getActiveItem().toggleActive();
this._isPopupOpen = false;
}
Expand Down

0 comments on commit 676f12c

Please sign in to comment.