# Designer - expanding/collapsing Perspective property lists

**URL:** <https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 10, 2023, 3:30pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284 "2023-10-10T15:30:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 10, 2023, 3:30pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284/1 "2023-10-10T15:30:56Z")

</div>

Some of our perspective views have a lot of properties, and navigating and viewing them is an irritation. They always default to expanding the 1 top level and keeping the rest closed. For some of our views that are holding multiple large lists/objects, this default is already very cluttered. I can click to collapse them all, but if I move to another component or view and back, then they expand again.

And if I do want to dig down to a single value that is nested multiple levels deep and expand one tree of properties, that also gets lost if I jump between components.

Is there a shortcut to "expand all" or "collapse all" on the property views? (keyboard, mouse, anything?)

Would it be feasible to have Designer remember in the short-term while a view is open what nesting levels are expanded/collapsed on each component?

In my particular case I would be even be happy if I could just change the default that it uses to be "expand 0 levels" and not "expand 1 level", so it would be a less cluttered starting point which is currently my bigger irritation.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 10, 2023, 4:24pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284/2 "2023-10-10T16:24:49Z")

</div>

Tragically, expand all and collapse all methods are available, just not exposed in the UI of the component...

For instance, this works from the script console:

```python
from com.inductiveautomation.ignition.designer import IgnitionDesigner
from com.inductiveautomation.perspective.common.api import PropertyType

designerGui = IgnitionDesigner.getFrame()
context = designerGui.context

dockingManager = context.dockingManager
propertyEditor = dockingManager.getFrame("PerspectivePropEditor")
propertyEditor.getEditorFor(PropertyType.props).collapseAll()

```

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 10, 2023, 4:44pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284/3 "2023-10-10T16:44:18Z")

</div>

That snippet doesn't seem to be doing anything when I run it. No errors on the console or log and no obvious effect. I can poke around at the variables like `dockingManager` and they are there and seem sensible.

Just to confirm, this should collapse the bit I circled in red:

 ![sample](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/89df5253a330c871f207c6c08fe56969f0d90db1.png)

---

<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:** [October 10, 2023, 4:50pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284/4 "2023-10-10T16:50:27Z")

</div>

Don't forget that the property filter is there. It is most useful.

![Property filter](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ecc60664c9514bc5a6d363f50a9870c1204769cc.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 10, 2023, 5:16pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284/5 "2023-10-10T17:16:21Z")

</div>

Well, don't you dare contact support if this ever ends up breaking or doing anything weird, but...  
If you run this in the script console once, it'll add two buttons to the designer toolbar that expand/collapse all the nodes in the current property tree:

[https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9bcbcac4161059afd73ee2323c45d2effbcc58b3.mp4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9bcbcac4161059afd73ee2323c45d2effbcc58b3.mp4)

```python
from java.lang import Runnable
from com.inductiveautomation.ignition.designer import IgnitionDesigner
from com.inductiveautomation.perspective.common.api import PropertyType
from com.inductiveautomation.ignition.client.util.action import BaseAction
from com.inductiveautomation.ignition.client.icons import VectorIcons

context = IgnitionDesigner.getFrame().context

propertyEditor = context.dockingManager.getFrame("PerspectivePropEditor")

class PropTreeManipulator(Runnable):
	def __init__ (self, callback):
		self.callback = callback
		
	def run(self):
		for propType in PropertyType.values():
			self.callback(propertyEditor.getEditorFor(propType))

expandAll = BaseAction.create(
	"Actions.ExpandAll",
	VectorIcons.get("expand-all"),
	PropTreeManipulator(lambda e: e.expandAll())
)
collapseAll = BaseAction.create(
	"Actions.CollapseAll",
	VectorIcons.get("collapse-all"),
	PropTreeManipulator(lambda e: e.collapseAll())
)

toolbar = context.toolbarManager.getDockableBar("com.inductiveautomation.perspective")
toolbar.addButton(expandAll)
toolbar.addButton(collapseAll)

```

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 11, 2023, 4:41pm UTC](https://forum.inductiveautomation.com/t/designer-expanding-collapsing-perspective-property-lists/80284/6 "2023-10-11T16:41:36Z")

</div>

I was going to ask how to get rid of the buttons, but they disappear as soon as you open a new project. It's a hacky workaround, but it works and it makes editing views less irritating. Thank you.
