Expand Specific Node on Tree View

Does anyone know why this code does not work to expand a specific path on a tree view? I do not get an error, but is also does nothing to the tree view on the window.

treeView = event.source.parent.getComponent('Tree View')

def expandNode(node, listPath):
	if(len(listPath) > 0):
		for childIndex in range(0, node.getChildCount()):
			child = node.getChildAt(childIndex)
			
			if(child.toString() == listPath[0]):
				print "expand node %s" % (child)
				treeView.expandNode(child, True)
				if(len(listPath) > 1):
					expandNode(child, listPath[1:])
						
				
expandNode(treeView.model.root, ["East Area", "Process", "Valve1"])

Did you ever get this to work?

No, I did not.

@PGriffith Any ideas?

Access to the underlying tree/model is unfortunately restricted in the tree view…

There’s a private method (com.inductiveautomation.factorypmi.application.components.PMITreeView#_expandAll(TreePath parent, boolean expand) - you can force access via reflection (made easier using MethodUtils) to try to invoke that manually.

Creating a TreePath might be somewhat awkward from Jython, because the two overloads accept Object or Object[], which Jython will have a hard time distinguishing.

That may be enough to get started.