# MenuTree selected item

**URL:** <https://forum.inductiveautomation.com/t/menutree-selected-item/49526>\
**Category:** Ignition\
**Created:** [August 3, 2021, 8:55pm UTC](https://forum.inductiveautomation.com/t/menutree-selected-item/49526 "2021-08-03T20:55:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![markrit](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/markrit/32/29635_2.png) [@markrit](https://forum.inductiveautomation.com/u/markrit)\
**Post date:** [August 3, 2021, 8:55pm UTC](https://forum.inductiveautomation.com/t/menutree-selected-item/49526/1 "2021-08-03T20:55:23Z")

</div>

How would i go about getting the item selected in a a MenuTree object and store into a Custom Session property?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 3, 2021, 11:27pm UTC](https://forum.inductiveautomation.com/t/menutree-selected-item/49526/2 "2021-08-03T23:27:37Z")

</div>

Not at laptop, but pretty sure you need to do this yourself using a custom view to display your menu items and have that write to the session prop. This is what I needed to do previously. Definitely something that could be nicer, as currently out of the box you can’t highlight the selected tab when it’s attached page is open (afaik)

---

<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:** [August 4, 2021, 3:41am UTC](https://forum.inductiveautomation.com/t/menutree-selected-item/49526/3 "2021-08-04T03:41:31Z")

</div>

If you look at the component methods for the [Menu Tree](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Menu+Tree) you’ll find what is actually an Event specific to the Menu Tree: `onItemClicked`. Within this event you have access to several properties of the item being clicked, and you can then write them to a session property.

`onItemClicked` example:

```auto
# include check to verify item being clicked is actually enabled.
if event.enabled:
    self.session.custom.lastURL = event.target

```
