# Perspective how to remove an item from a tree dynamicaly

**URL:** <https://forum.inductiveautomation.com/t/perspective-how-to-remove-an-item-from-a-tree-dynamicaly/69557>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 7, 2023, 10:48pm UTC](https://forum.inductiveautomation.com/t/perspective-how-to-remove-an-item-from-a-tree-dynamicaly/69557 "2023-02-07T22:48:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrutten](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mrutten](https://forum.inductiveautomation.com/u/mrutten)\
**Post date:** [February 7, 2023, 10:48pm UTC](https://forum.inductiveautomation.com/t/perspective-how-to-remove-an-item-from-a-tree-dynamicaly/69557/1 "2023-02-07T22:48:22Z")

</div>

Is there a way to programmatically remove an item in a tree component?  
I know how to add it but not how to delete it.

To add I use the items.append

stylestring = {'classes':'TreeIcon\_NoComms'}  
itemstring = {'label':data["Loop\_1"]["LoopName"],"expanded":bool(1),'icon':iconstring,'items':}  
self.getChild("Tree").props.items[0].items.append(itemstring)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 8, 2023, 12:30am UTC](https://forum.inductiveautomation.com/t/perspective-how-to-remove-an-item-from-a-tree-dynamicaly/69557/2 "2023-02-08T00:30:50Z")

</div>

Have you tried using `self.getChild("Tree").props.items[0].items.pop(index_of_item_to_remove)`?

Also, you should be aware of [this bug](https://forum.inductiveautomation.com/t/bug-15347-objectwrapper-modification/29692) when attempting to modify something with an objectWrapper type using normal python dictionary/list methods.

---

<div class="post-metadata">

**Author:** ![mrutten](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mrutten](https://forum.inductiveautomation.com/u/mrutten)\
**Post date:** [February 8, 2023, 12:12pm UTC](https://forum.inductiveautomation.com/t/perspective-how-to-remove-an-item-from-a-tree-dynamicaly/69557/3 "2023-02-08T12:12:15Z")

</div>

That works. Thank you.
