# How to disable the multiple selection in Perspective Tree component?

**URL:** <https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [December 28, 2023, 10:39am UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569 "2023-12-28T10:39:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![VIGNESH\_S](https://avatars.discourse-cdn.com/v4/letter/v/8baadc/32.png) [@VIGNESH\_S](https://forum.inductiveautomation.com/u/VIGNESH_S)\
**Post date:** [December 28, 2023, 10:39am UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/1 "2023-12-28T10:39:54Z")

</div>

Hello Everyone,  
I am using the tree view component in ignition perspective 8.1. Where i need to disable the multiple selection of tags. Can anyone suggest how to fix this issue.  
Concern is instead of multiple selection need to allow single selection.  
PFA,

 ![IA_img2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/89a126689be5da5eaf4028540e8a98ec737ca965.jpeg)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 28, 2023, 10:55am UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/2 "2023-12-28T10:55:43Z")

</div>

There doesn't seem to be an option.

It looks as though the last item clicked is at the bottom of the list so you could add a script to the onItemClicked event to delete all the `props.selection` and `props.selectionData` entries except for the last. (You would need to handle deselecting all items too.)

See if there are any clues in [Tree in perspective, multiselect label](https://forum.inductiveautomation.com/t/tree-in-perspective-multiselect-label/56661).

---

<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:** [December 28, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/3 "2023-12-28T16:34:04Z")

</div>

place this in the `onItemClicked` script:

```auto
def runAction(self, event):
	itemPath = '/'.join([str(_) for _ in event.itemPath])
	self.props.selection = [itemPath]
	if len(self.props.selectionData) > 0:
		self.props.selectionData = [self.props.selectionData[-1]]

```

Edit: Updated to keep `selectionData` synchronized. Note that this script does not manage de-selection of items.

---

<div class="post-metadata">

**Author:** ![VIGNESH\_S](https://avatars.discourse-cdn.com/v4/letter/v/8baadc/32.png) [@VIGNESH\_S](https://forum.inductiveautomation.com/u/VIGNESH_S)\
**Post date:** [March 19, 2024, 7:34am UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/4 "2024-03-19T07:34:35Z")

</div>

Thanks for your response.  
But now it is happening in same way when I select multiple tags it selects the last one. My concern is not allow for multiple selection. If user tries to press ctrl key and selects too it should not allow.  
As in our vision We have an option called "Single / Multiple " Selection. Do we have such kind of property in Perspective.

---

<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:** [March 19, 2024, 3:03pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/5 "2024-03-19T15:03:22Z")

</div>

No, not for that component.

---

<div class="post-metadata">

**Author:** ![sanzio](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sanzio](https://forum.inductiveautomation.com/u/sanzio)\
**Post date:** [December 23, 2025, 8:37pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/6 "2025-12-23T20:37:09Z")

</div>

Adding to @cmallonee’s answer… If you want to also disable branchNodeSelectable, function would need to be modified. This is working for me, although I’m sure it could be simplified.

```python
def runAction(self, event):
	itemPath = '/'.join([str(_) for _ in event.itemPath])
	node = self.props.items[event.itemPath[0]]
	for index in event.itemPath[1:]:
		node = node.items[index]
	if not node.get('items'):
		self.props.selection = [itemPath]
		if len(self.props.selectionData) > 0:
			self.props.selectionData = [self.props.selectionData[-1]]

```

---

<div class="post-metadata">

**Author:** ![Stephen\_Kreyling](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Stephen\_Kreyling](https://forum.inductiveautomation.com/u/Stephen_Kreyling)\
**Post date:** [July 14, 2026, 2:42pm UTC](https://forum.inductiveautomation.com/t/how-to-disable-the-multiple-selection-in-perspective-tree-component/83569/7 "2026-07-14T14:42:37Z")

</div>

This looks simpler, and works (in the onItemClicked runAction):

```python
	# Don't allow multiple selection
	while len(self.props.selection) > 1:
		self.props.selection.pop()
		self.props.selectionData.pop()

```
