From 4baa4becfecccb2446aae09a6a3bb1fd1d4800ca Mon Sep 17 00:00:00 2001 From: milan Date: Thu, 28 Nov 2024 12:49:48 +0100 Subject: [PATCH] change condition of lazy loading to be true if selectOption.children is undefined --- api/js/etemplate/Et2Tree/Et2Tree.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 5a19413c8d..3aa4be6546 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -982,9 +982,15 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin if (!img) img = selectOption.icon ?? selectOption.im0 ?? selectOption.im1 ?? selectOption.im2; // lazy iff "child" is set and "children" is empty or children does not exist in the first place - const lazy = typeof selectOption.item !== "undefined" ? - (selectOption.item?.length === 0 && selectOption.child) || (selectOption.child && !selectOption.item) : - (selectOption.children?.length == 0 && selectOption.child); + let lazy: Boolean | 1 | 0; + if (typeof selectOption.item !== "undefined") + { + lazy = (selectOption.item?.length === 0 && selectOption.child) || (selectOption.child && !selectOption.item); + } else + { + lazy = (typeof selectOption.children === "undefined" || selectOption.children?.length == 0) + && selectOption.child; + } const value = selectOption.value ?? selectOption.id; if(expandState && this.autoloading && lazy) {