From 3cc5d910b8da3757a8e471070f4654ea294c6219 Mon Sep 17 00:00:00 2001 From: milan Date: Thu, 28 Mar 2024 18:51:56 +0100 Subject: [PATCH] click on tree-item now triggers the onclick event --- previous it was only triggered on change of folder --- api/js/etemplate/Et2Tree/Et2Tree.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 8c2b6df0f6..a5e25184fd 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -151,7 +151,6 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) // Actions can't be initialized without being connected to InstanceManager this._initActions(); - //TODO do it on first updated this._link_actions(this.actions) } @@ -163,6 +162,11 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) //Sl-Trees handle their own onClick events _handleClick(_ev) { + //if onclick is defined, and we have a resonable target (e.g. one single item that was clicked on, trigger the onclick function + if (typeof this.onclick == "function" && typeof _ev.target.value == "string") + { + this.onclick(_ev.target.value, this, _ev.target.value) + } } static get styles()