How to detect the item that was expanded/collapsed in a Tree component?

I don’t know if I’m wasting my time.. but I’m attempting to create a historical tag tree browser with filtering ability. I’ve got a few things I want to include though, like:

  • include the tooltip of tags in the tree nodes (e.g. “Tag name - This is the tooltip text”)
  • include the description parameter of Udt instances, if available (e.g. “ABC-PMP01 - Tank Outlet Pump”)
  • ability to filter on tagpath as well as the extra info (tooltip or udt instance description)
  • [expand]/collapse all nodes (might have to think about this when expanding for large numbers of tags)

Perhaps obviously, when I set the Tree’s props.items to include a moderate number of tags, the web socket has a hissy fit and the client goes in and out of being connected.

So I wanted to implement something “smarter” and update the items with only the branches shown. Upon expanding/collapsing the nodes, I want to trigger the items to be regenerated again to show or remove the nodes. But there’s no “onNodeExpand/Collapse” event handler on the tree :confused:

I have some javascript mutation observer that can fire whenever an item is expanded/collapsed, however I have no idea how to get the node path so I can do something useful with it… (I can provide it but it’s a dodgy AI-written monstrosity that has some issues at the moment)

I don’t know if @victordcq is still on here :slight_smile: or @bmusson perhaps can help (sorry for the pings)

Or maybe I should just leave this beast alone

We do this in Vision but haven’t been able to use the treeview in Perpective the same way.

We switched over to using a table view with a single column visible (toolTip/TagName) and the other values in hidden columns. It is fully filterable and has all of the needed information.