diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 8e6fff7379..8b40b34eb5 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -98,7 +98,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin @property({type: Function}) onclick;// description: "JS code which gets executed when clicks on text of a node" @property({type:String}) - selection = "single" + leafOnly = false //onselect and oncheck only appear in multiselectTree diff --git a/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts b/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts index a4a2496a75..95a35036f6 100644 --- a/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts +++ b/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts @@ -81,15 +81,34 @@ export class Et2TreeDropdown extends SearchMixin & Et2InputWidg @property({type: Object}) actions = {}; @property() - leafOnly:Boolean; + set leafOnly(_leafOnly: boolean) + { + this.updateComplete.then(() => { + const tree = this._tree + if (tree) + { + tree.leafOnly = _leafOnly; + tree.requestUpdate("leafOnly") + + } + } + ) + } @state() currentTag: Et2Tag; // We show search results in the same dropdown @state() treeOrSearch : "tree" | "search" = "tree"; - private get _popup() : SlPopup { return this.shadowRoot.querySelector("sl-popup")} - private get _tree() : Et2Tree { return this.shadowRoot.querySelector("et2-tree")} + private get _popup(): SlPopup + { + return this.shadowRoot?.querySelector("sl-popup") + } + + private get _tree(): Et2Tree + { + return this.shadowRoot?.querySelector("et2-tree") + } private get _tags() : Et2Tag[] { return Array.from(this.shadowRoot.querySelectorAll("et2-tag"));}