# Menu Tree: How to Auto-Select & Expand Items Using a "source" Parameter?

**URL:** <https://forum.inductiveautomation.com/t/menu-tree-how-to-auto-select-expand-items-using-a-source-parameter/112477>\
**Category:** General Discussion\
**Tags:** perspective, ignition81, scripting\
**Created:** [November 27, 2025, 7:55am UTC](https://forum.inductiveautomation.com/t/menu-tree-how-to-auto-select-expand-items-using-a-source-parameter/112477 "2025-11-27T07:55:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GOKULAKANNAN\_P](https://avatars.discourse-cdn.com/v4/letter/g/0ea827/32.png) [@GOKULAKANNAN\_P](https://forum.inductiveautomation.com/u/GOKULAKANNAN_P)\
**Post date:** [November 27, 2025, 7:55am UTC](https://forum.inductiveautomation.com/t/menu-tree-how-to-auto-select-expand-items-using-a-source-parameter/112477/1 "2025-11-27T07:55:40Z")

</div>

Hi all,

I’m using a **Perspective Menu Tree** with nested items (example: _Alarms → Alarm Overview / Alarm Rules_, _Settings → User Management / Asset Management_).

My **onItemClicked script works** , but I also need the menu to update **when a view parameter changes** , like:

```python
view.params.source = "Alarm Overview"

```

### **What I want**

- Highlight the correct menu item

- Change icon color

- Auto-expand its parent (Alarms, Settings, etc.)

- Only one item selected at a time

- Works for both root and submenu items

### **The issue**

The `source` propertyChange script is not consistent:

- submenu does not expand

### **My question**

👉 **What is the best way to programmatically select + highlight a Menu Tree item and expand its parent based on a parameter?**  
If anyone has a clean example script for this, it would help a lot.

Thanks in advance 🙂 !

---

<div class="post-metadata">

**Author:** ![Cose\_Peter1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cose_peter1/32/79174_2.png) [@Cose\_Peter1](https://forum.inductiveautomation.com/u/Cose_Peter1)\
**Post date:** [November 27, 2025, 9:55am UTC](https://forum.inductiveautomation.com/t/menu-tree-how-to-auto-select-expand-items-using-a-source-parameter/112477/2 "2025-11-27T09:55:52Z")

</div>

You can use this to highlight selections on the menu tree.

> [@Menu tree item highlight after selection on click](https://forum.inductiveautomation.com/t/menu-tree-item-highlight-after-selection-on-click/89866/7):
>
> Fantastic! Here is the script and style reference that works for me. The length of the menu tree can vary dynamically. If you prefer not to manually create a Map transform binding for each item, this solution could be quite helpful. play_button MenuTree\>onItemClickedplay_button stylesheet.css

If you want the menu tree to update when the view parameter changes, you need to implement the above functionality in a message handler and call the message handler on value change of the view parameter.

The message handler must be placed on the same menu tree component that you want to see the functionality on.
