cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
thickey
Level III

Traversing a nested tree box.

I am building a dynamic tree box based on a directory structure.....so I don't know in advance how many roots and nodes there will be in the tree. The final nodes of the tree could have the same name. I then put the tree into an application.

When a user clicks on a node I want to re-create the 'Path' from that node back to the root.

 

So if someone selects say 'Ducato' I want to be returned 'Trucks - Fiat - Ducato' Similarly if you picked a node that was not the final leaf it would also work. For example selecting 'Audi' would return 'Cars - Audi' 

thickey_1-1631806721454.png

 

I can get a list of roots or the text of the item selected 

 

show((myDirTree << Get Selected) << getLabel);
show((myDirTree << getRoots) << getLabel);

And I can run a script when a selection is made.

myTree << setNodeSelectScript( 
	show((myTree << Get Selected) << getLabel);
	show((myTree << Get Roots) << getLabel)	
);

But I do not know how to get the 'path' back to the root each node takes........

 

Cheers, Troy

 

 

1 REPLY 1

Re: Traversing a nested tree box.

You can 'walk back' using the Parent message to the current display box.

 

See Help > Scripting Guide:

 

parent.PNG