From d14f94aaa7bf8a56d7bb800a9a9e86b993f3c37e Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 22 Jan 2020 10:19:07 -0700 Subject: [PATCH] - Add some more parameter types - Solve the uninitialized attribute issue (for insertChild() called from constructor at least) --- api/js/etemplate/et2_core_widget.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/et2_core_widget.ts b/api/js/etemplate/et2_core_widget.ts index c3d2b39a26..251efac8a5 100644 --- a/api/js/etemplate/et2_core_widget.ts +++ b/api/js/etemplate/et2_core_widget.ts @@ -368,7 +368,7 @@ export class et2_widget extends ClassWithAttributes * @param _node is the node which should be added. It has to be an instance * of et2_widget */ - addChild(_node) + addChild(_node : et2_widget) { this.insertChild(_node, this._children.length); } @@ -380,7 +380,7 @@ export class et2_widget extends ClassWithAttributes * of et2_widget * @param _idx is the position at which the element should be added. */ - insertChild(_node, _idx) + insertChild(_node : et2_widget, _idx: number) { // Check whether the node is one of the supported widget classes. if (this.isOfSupportedWidgetClass(_node)) { @@ -391,13 +391,15 @@ export class et2_widget extends ClassWithAttributes _node._parent = this; this._children.splice(_idx, 0, _node); - - if (_node.implements(et2_IDOMNode) && this.implements(et2_IDOMNode) && _node.parentNode) { +/* +Comment this out (for now) + if (_node.implements(et2_IDOMNode) && this.implements(et2_IDOMNode) && typeof _node.hasOwnProperty('parentNode') ) + { _node.detachFromDOM(); _node.parentNode = (this).getDOMNode(_node); _node.attachToDOM(); } - +*/ } else { this.egw().debug("error", "Widget " + _node._type + " is not supported by this widget class", this); // throw("Widget is not supported by this widget class!");