Perspective Tree - No component event to detect item expanded?

The Perspective Accordion component has an onItemExpanded component event, but the Perspective Tree doesn't. It looks like there is only onItemClicked, which doesn't fire when the branch node is expanded. Is there any way to gracefully detect that a tree's node has been expanded?

For context, I am looking to build a tree's items dynamically using API calls to get each tree level as the user navigates. The source of the data is tens-of-millions of pieces of equipment in SAP, so rather than build a massive tree with a bunch of nodes the user doesn't care about, and in order to be efficient, I only want to add to the tree's items property as the user expands a node. Once a node is expanded, I would like to call an API to get the children and update the tree only for the expanded node.

I'm currently exploring using the onItemClicked and programmatically expanding the node, but it feels hacky because I have to click the label of the node for it to fire, which is not intuitive for users who are used to clicking the expand icon.

4 Likes

Has you been able to solve this issue? I am having the same exact problem.

You can try binding to or putting an event script on the items’ expanded properties, but if you need a truly dynamically updating tree, I would think you could put a binding or script on the overarching items property. Maybe in the ‘onClick’ event of the component, you can read the items property, find newly expanded nodes, call the API, and write back to the items property. Haven’t played around with any of this myself.