TreeView: onNodeExpand and onNodeSelect events are not working with programmatically working

UI Components for Angular
Post Reply
Posts: 3
Joined: 08 Jul 2020, 13:12

08 Jul 2020, 13:27


I have a tree view with lazy loading. So I get all children when I expand a node with a method on (onNodeExpand).
This is working.

But I have two use-cases which are not working with these events:
(1) Expand a node programmatically:
I want to open one node per script as an result of an event. But when I only change the "expanded" state of the node then only the icon is changing.
But it is not calling the "onNodeExpand" event. So my lazy-loading is not working at this moment and the node is empty. :(

(2) Selecting a node programmatically:
The same with the onNodeSelect event. I have a variable for selection [(selection)]="selectedNodes". When I set one or more items ins this Array the tree is showing the selection correctly! But the onSelectNode action is not called for the new selection.
This case is not such a big problem cause I can duplicate all my events in "onSelectNode". But it would be easier when the action would be called.

Has anyone an idea for use-case (1)?

Posts: 3
Joined: 08 Jul 2020, 13:12

09 Jul 2020, 11:50

I solved this by calling a function which is overwriting the main object nested and then set necesarry expanded-states to true.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests