# Tree view folder & subfolder creations

**URL:** <https://forum.inductiveautomation.com/t/tree-view-folder-subfolder-creations/91027>\
**Category:** Ignition\
**Tags:** scripting, ignition81, perspective\
**Created:** [May 28, 2024, 6:15pm UTC](https://forum.inductiveautomation.com/t/tree-view-folder-subfolder-creations/91027 "2024-05-28T18:15:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shyam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shyam/32/42528_2.png) [@Shyam](https://forum.inductiveautomation.com/u/Shyam)\
**Post date:** [May 28, 2024, 6:15pm UTC](https://forum.inductiveautomation.com/t/tree-view-folder-subfolder-creations/91027/1 "2024-05-28T18:15:38Z")

</div>

Hello guys,  
need to create folder in perspective tree component and after selecting particular parent folder depends on user requirements sub folders needs to create.

Pls suggest.....

---

<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:** [May 28, 2024, 6:22pm UTC](https://forum.inductiveautomation.com/t/tree-view-folder-subfolder-creations/91027/2 "2024-05-28T18:22:34Z")

</div>

The tree can be used to represent a folder structure but it doesn't have "folders" or "sub-folders". It has a list of **items** and each of the items can contain a list of items to give the tree structure.

> [@Shyam](#):
>
> Pls suggest.....

Make a mockup manually, take a neatly cropped screengrab and post it here. Then explain what the user is to do and what the script is to do.

> [@Shyam](#):
>
> ... and after selecting particular **parent ~~folder~~ item** depends on user requirements sub ~~folders~~ _items_ needs to create.

If the user is selecting a **parent** item then it already has children. Does it?

What item structure is to be created.

I think if you can define the problem properly that the solution will become much clearer.

---

<div class="post-metadata">

**Author:** ![Shyam](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shyam/32/42528_2.png) [@Shyam](https://forum.inductiveautomation.com/u/Shyam)\
**Post date:** [May 29, 2024, 4:16am UTC](https://forum.inductiveautomation.com/t/tree-view-folder-subfolder-creations/91027/3 "2024-05-29T04:16:52Z")

</div>

@Transistor

Requirement is :  
user can create n number of parent items and subitems with limitation (upto 5)  
after creation of parent item & sub items depends on user selection need to pass the table data into selected item (parent item or sub item) which we are getting from params

Plus File Icon : to create items  
Add to Favourite Button : to add the data into selected item  
Text Field : to name the items

added my view snap here

 ![treeview](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/3/e385b2c65eb9671647fc66a0b282015addad9300.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:** [May 29, 2024, 9:49am UTC](https://forum.inductiveautomation.com/t/tree-view-folder-subfolder-creations/91027/4 "2024-05-29T09:49:37Z")

</div>

That's going to be a little tricky and I don't know how to do it.

1. The user will have to select a branch of the tree first before the text field and Add button are enabled.
2. That will give you something like `props.selection.0 : 0/0/1/0`.
3. You then need to convert that into something like,  
` self.props.items[0].items[0].items[1].addItem(...)`

Other points:  
4. You have no root object so you can't add another parent.

I think that using the context-menu (right-click on the tree) might be simpler to code.
