Permalink
Browse files

[IMP] web: control panel add on_detach_callback

Adding event listener in on_attach_callback need to be removed
in on_detach_callback.

Before this commit on_detach_callback was not implemented in control panel.
After this commit we can use on_detach_callback.

Needed for task ID: 1934261

closes #30758
  • Loading branch information...
rfr-odoo committed Jan 31, 2019
1 parent 969705f commit e6e206b14e3c3f0274b9d8e723ab1f40c53efe68
@@ -104,6 +104,9 @@ var AbstractController = mvc.Controller.extend(ActionMixin, {
* Called each time the controller is detached from the DOM.
*/
on_detach_callback: function () {
if (this._controlPanel) {
this._controlPanel.on_detach_callback();
}
this.renderer.on_detach_callback();
},

@@ -35,6 +35,12 @@ var ControlPanelController = mvc.Controller.extend({
on_attach_callback: function () {
this.renderer.on_attach_callback();
},
/**
* Called when the control panel is remove form the DOM.
*/
on_detach_callback: function () {
this.renderer.on_detach_callback();
},

//--------------------------------------------------------------------------
// Public
@@ -96,6 +96,11 @@ var ControlPanelRenderer = Renderer.extend({
on_attach_callback: function () {
this._focusSearchInput();
},
/**
* @override
*/
on_detach_callback: function () {
},

//--------------------------------------------------------------------------
// Public

0 comments on commit e6e206b

Please sign in to comment.