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

**URL:** <https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 14, 2020, 6:56pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667 "2020-09-14T18:56:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [September 14, 2020, 6:56pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/1 "2020-09-14T18:56:38Z")

</div>

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’?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/9/4912eae8382cb0c858eaa4c2ce6e919a3c96cc3a.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 14, 2020, 8:56pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/2 "2020-09-14T20:56:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [September 14, 2020, 9:14pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/3 "2020-09-14T21:14:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 14, 2020, 9:18pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/4 "2020-09-14T21:18:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [September 14, 2020, 9:25pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/5 "2020-09-14T21:25:45Z")

</div>

Understood, thank you.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 15, 2020, 3:12am UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/6 "2020-09-15T03:12:47Z")

</div>

> [@cmallonee](#):
>
> There is not a way to manage this right now short of refreshing the entire page

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?

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [September 15, 2020, 5:40am UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/7 "2020-09-15T05:40:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dkylep](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@dkylep](https://forum.inductiveautomation.com/u/dkylep)\
**Post date:** [September 15, 2020, 3:56pm UTC](https://forum.inductiveautomation.com/t/feature-485-perspective-menutree-force-back-on-click/38667/8 "2020-09-15T15:56:12Z")

</div>

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.
