# How make tree component select a specific item by script

**URL:** <https://forum.inductiveautomation.com/t/how-make-tree-component-select-a-specific-item-by-script/49132>\
**Category:** Ignition Early Access\
**Created:** [July 23, 2021, 12:46pm UTC](https://forum.inductiveautomation.com/t/how-make-tree-component-select-a-specific-item-by-script/49132 "2021-07-23T12:46:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [July 23, 2021, 12:46pm UTC](https://forum.inductiveautomation.com/t/how-make-tree-component-select-a-specific-item-by-script/49132/1 "2021-07-23T12:46:50Z")

</div>

Hi  
I try to force component tree to select a specific item by changing the props.selection[0] property in a button script.  
But it seems it doesn’t work. I find out when I change the value in designer and then press button it works and make item selected.  
I also delete property and recreate again in button script to trigger this functionality but it doesn’t work neither.

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [July 23, 2021, 5:04pm UTC](https://forum.inductiveautomation.com/t/how-make-tree-component-select-a-specific-item-by-script/49132/2 "2021-07-23T17:04:39Z")

</div>

That _is_ strange. adding an onClick event to a button to change the props.selection[0] property of a tree component works in the designer in preview mode, but not initially in a proper session. I was only able to get the button to work by first selecting another item in the tree, then clicking the button.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [July 23, 2021, 5:07pm UTC](https://forum.inductiveautomation.com/t/how-make-tree-component-select-a-specific-item-by-script/49132/3 "2021-07-23T17:07:15Z")

</div>

Yes that’s the problem only you can change selection by script if user change it my mouse before for only one time.
