diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 2a9145c85f..366c4f9a18 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -289,7 +289,7 @@ const Et2WidgetMixin = (superClass) => { let oldValue = this._widget_id; this._widget_id = value; - this.setAttribute("id", this._widget_id ? this.getInstanceManager().uniqueId + '_' + this._widget_id.replace(/\./g, '-') : ""); + this.setAttribute("id", this._widget_id ? this.getInstanceManager()?.uniqueId + '_' + this._widget_id.replace(/\./g, '-') : ""); this.requestUpdate("id", oldValue); } @@ -828,13 +828,6 @@ const Et2WidgetMixin = (superClass) => // Create the copy var copy = this.cloneNode(); - let widget_class = window.customElements.get(this.localName); - let properties = widget_class ? widget_class.properties : []; - for(let key in properties) - { - copy[key] = this[key]; - } - if(_parent) { copy.setParent(_parent); @@ -848,6 +841,13 @@ const Et2WidgetMixin = (superClass) => copy.setInstanceManager(this.getInstanceManager()); } + let widget_class = window.customElements.get(this.localName); + let properties = widget_class ? widget_class.properties : []; + for(let key in properties) + { + copy[key] = this[key]; + } + // Create a clone of all child widgets of the given object for(var i = 0; i < this.getChildren().length; i++) {