change condition of lazy loading to be true if selectOption.children is undefined

This commit is contained in:
milan 2024-11-28 12:49:48 +01:00
parent ba84d20eb4
commit 4baa4becfe

View File

@ -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)
{