From 79bcabc8887cb4696c3f0dfa28ac6b46e2a4cd12 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 15 Feb 2024 13:43:52 -0700 Subject: [PATCH] Get tree working in projectmanager --- api/js/etemplate/Et2Tree/Et2Tree.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 2cdc002e9f..828a741601 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -594,8 +594,13 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) ?lazy=${selectOption.item?.length === 0 && selectOption.child} ?focused=${selectOption.focused || nothing} @sl-lazy-load=${(event) => { + // No need for this to bubble up, we'll handle it (otherwise the parent leaf will load too) + event.stopPropagation(); + this.handleLazyLoading(selectOption).then((result) => { - this.getNode(selectOption.id).item = [...result.item] + // TODO: We already have the right option in context. Look into this.getNode(), find out why it's there. It doesn't do a deep search. + const parentNode = selectOption ?? this.getNode(selectOption.id) ?? this.optionSearch(selectOption.id, this._selectOptions, 'item'); + parentNode.item = [...result.item] this.requestUpdate("_selectOptions") })