# Set selected items on a tree view

**URL:** <https://forum.inductiveautomation.com/t/set-selected-items-on-a-tree-view/17562>\
**Category:** Ignition\
**Created:** [March 30, 2018, 7:21pm UTC](https://forum.inductiveautomation.com/t/set-selected-items-on-a-tree-view/17562 "2018-03-30T19:21:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [March 30, 2018, 7:21pm UTC](https://forum.inductiveautomation.com/t/set-selected-items-on-a-tree-view/17562/1 "2018-03-30T19:21:45Z")

</div>

I’m using a tree view component to select multiple folders, or items, or a combination. The desire is to press a button to open this up, select what you want, and hit a button to go do other stuff with the selected items. However, if you click outside of it or something, the tree view will become invisible **and the selections set to what they were before it was set to visible in the first place**. I have everything setup so far, its just the part about setting the selections to how they were previously thats messing me up. I’ve tried the PMITreeView function setSelectedPath(path) but unfortunately that isn’t cumulative or anything.

Anyone have a suggestion for how to select multiple items or folders on the tree?

Edit: I did some research on JTree in Java, based on similar components I think and [here](https://stackoverflow.com/questions/10242896/java-how-to-programmatically-select-and-expand-multiple-nodes-in-a-jtree?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) they say if you can get the TreeSelectionModel, they have a setSelectedPaths() function that does what I want. But I can’t tell how to get Ignition’s version of this, if it exists at all.

One more edit, I think I was mistaken thinking JTree was based on similar things. I wish I was better with Java 🙂

---

<div class="post-metadata">

**Author:** ![salbrechtsen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/salbrechtsen/32/18660_2.png) [@salbrechtsen](https://forum.inductiveautomation.com/u/salbrechtsen)\
**Post date:** [July 31, 2018, 11:09pm UTC](https://forum.inductiveautomation.com/t/set-selected-items-on-a-tree-view/17562/2 "2018-07-31T23:09:46Z")

</div>

Encountering this same thing… Would it be possible for the setSelectedPaths function to be exposed in the Ignition version of this component?
