[Feature-485]Perspective MenuTree, force back on click

I’m using a perspective menutree to organize a series of commands that need to be performed and it works well. But I want it to force the menutree to navigate back when a sub item is clicked.

Is it possible to force the menutree to navigate back to a previous menu when item is clicked? Is there a script command that will make it go back or refresh/reload the menutree?

For example if I click on Sub Item 2 of Main item 1 can I want to force the menu tree to navigate back to the ‘Main menu’?

There is not a way to manage this right now short of refreshing the entire page. I’ve opened an internal feature ticket to provide a component method you could use in scripting (within the onItemClicked method) so that custom logic could be used to determine when the “reset” or “collapseSubItems” occurs.

1 Like

Something like that would be great! Thanks

I am currently using the onItemClicked Event to know what item I am clicking on (based on the event.path list) and adding custom script to accomplish some tasks when items are clicked. If I could just add self.collapse when an item is clicked, it would be perfect.

That’s the plan, but you would want to check conditions for the clicked item because the onItemClicked event fires even when you click on the top-level items; if you don’t pare-down what items actually invoke the component method I’m recommending then it wold result in no item expansion because the top-level items would register the click to expand and then collapse themselves.

Understood, thank you.

Definitely a hacky workaround, that I haven’t tested, but i wonder if you could do this by just refreshing the item property in some way?

Impressively this does not work. Even if you clear the item property, wait a second, and then reload it. The component remembers its currently selected item and re-navigates to it.

That’s actually pretty impressive and probably ideal when the menutree is used for Navigation (like it is intended). I would be happy with a work around in the short term but it doesn’t look like it’s an option. Thanks for giving this a try.