From b802aa64a837a42e1761182551b67ff6393494fa Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 8 Feb 2013 13:25:56 +0000 Subject: [PATCH] Override et2_container.destroy() to not try to remove itself from the parent, it does not have a parent --- etemplate/js/et2_core_baseWidget.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_core_baseWidget.js b/etemplate/js/et2_core_baseWidget.js index dd51d59cf0..94dd8308db 100644 --- a/etemplate/js/et2_core_baseWidget.js +++ b/etemplate/js/et2_core_baseWidget.js @@ -287,8 +287,29 @@ var et2_container = et2_baseWidget.extend({ this._super.apply(this, arguments); this.setDOMNode(document.createElement("div")); - } + }, + /** + * The destroy function destroys all children of the widget, removes itself + * from the parents children list. + * Overriden to not try to remove self from parent, as that's not possible. + */ + destroy: function() { + // Call the destructor of all children + for (var i = this._children.length - 1; i >= 0; i--) + { + this._children[i].free(); + } + + // Free the array managers if they belong to this widget + for (var key in this._mgrs) + { + if (this._mgrs[key] && this._mgrs[key].owner == this) + { + this._mgrs[key].free(); + } + } + } }); /**