diff --git a/ui-ngx/src/app/shared/components/nav-tree.component.ts b/ui-ngx/src/app/shared/components/nav-tree.component.ts index 60405613fb..5b698a37d3 100644 --- a/ui-ngx/src/app/shared/components/nav-tree.component.ts +++ b/ui-ngx/src/app/shared/components/nav-tree.component.ts @@ -52,10 +52,6 @@ export interface NavTreeEditCallbacks { clearSearch?: () => void; } -interface JSTreeEventDataWithAction extends JSTreeEventData { - action: string; -} - export type NodesCallback = (nodes: NavTreeNode[]) => void; export type LoadNodesCallback = (node: NavTreeNode, cb: NodesCallback) => void; export type NodeSearchCallback = (searchText: string, node: NavTreeNode) => boolean; @@ -153,9 +149,9 @@ export class NavTreeComponent implements OnInit { this.treeElement = $('.tb-nav-tree-container', this.elementRef.nativeElement).jstree(config); - this.treeElement.on('changed.jstree', (e: any, data: JSTreeEventDataWithAction) => { - const node: NavTreeNode = data.instance.get_selected(true)[0]; + this.treeElement.on('changed.jstree', (e: any, data) => { if (this.onNodeSelected && data.action !== 'ready') { + const node: NavTreeNode = data.instance.get_selected(true)[0]; this.ngZone.run(() => this.onNodeSelected(node, e as Event)); } }); diff --git a/ui-ngx/src/typings/jquery.jstree.typings.d.ts b/ui-ngx/src/typings/jquery.jstree.typings.d.ts index 0aa6a0b92e..933a9c60d5 100644 --- a/ui-ngx/src/typings/jquery.jstree.typings.d.ts +++ b/ui-ngx/src/typings/jquery.jstree.typings.d.ts @@ -27,6 +27,7 @@ interface JQuery { interface JSTreeEventData { instance: JSTree; + action: string; } interface JSTreeModelEventData extends JSTreeEventData {