diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 34a9dae462..44498d3545 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -42,8 +42,23 @@ export type TreeItemData = SelectOption & { nocheckbox: number | Boolean, open: 0 | 1, - parent: String, - text: String, + /** + * @deprecated Use "value" + */ + id : string, + /** + * @deprecated No longer used, the nested data structure is used instead + */ + parent : string, + /** + * @deprecated Use "label" + */ + text : string, + /** + * @deprecated Use "children" + */ + item : object[], + tooltip: String, userdata: any[] //here we can store the number of unread messages, if there are any @@ -1028,7 +1043,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin parentNode.open = false; this.requestUpdate("lazy", "true"); } - this.getDomNode(parentNode.id).loading = false + this.getDomNode(parentNode.id ?? parentNode.value).loading = false this.requestUpdate("_selectOptions") }) diff --git a/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts b/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts index b46a973e6c..da23ce1606 100644 --- a/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts +++ b/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts @@ -161,6 +161,17 @@ export class Et2TreeDropdown extends SearchMixin & Et2InputWidg document.addEventListener("click", this.handleDocumentClick); } + firstUpdated() + { + let options = this.multiple || !this.emptyLabel ? this.select_options : [{ + value: "", + label: this.emptyLabel + }, ...this.select_options]; + + this._tree._selectOptions = options; + this._tree.requestUpdate("_selectOptions"); + } + disconnectedCallback() { super.disconnectedCallback();