# Recursive treeList

**URL:** https://discourse.nodered.org/t/recursive-treelist/59543
**Category:** Developing Nodes
**Created:** [8 March 2022 15:48 UTC](https://discourse.nodered.org/t/recursive-treelist/59543 "2022-03-08T15:48:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cloud-rocket](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cloud-rocket/32/48745_2.png) [@cloud-rocket](https://discourse.nodered.org/u/cloud-rocket)
#### Post date: [8 March 2022 15:48 UTC](https://discourse.nodered.org/t/recursive-treelist/59543/1 "2022-03-08T15:48:30Z")

</div>

I'd like to use [treeList widget](https://nodered.org/docs/api/ui/treeList/) to allow a user to select nodes from a huge data tree (file system). A specific node content can be loaded dynamically using `$.getJSON` with a "path" argument.

I noticed that treeList supports this dynamic approach by passing the getJSON function as an argument for `children`. Yet am not sure how to accomplish it recursively.

Help appreciated!  
Thanks

---

<div class="post-metadata">

### Author: ![cloud-rocket](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cloud-rocket/32/48745_2.png) [@cloud-rocket](https://discourse.nodered.org/u/cloud-rocket)
#### Post date: [8 March 2022 18:26 UTC](https://discourse.nodered.org/t/recursive-treelist/59543/2 "2022-03-08T18:26:31Z")

</div>

Ok, found an answer on my own - there is an undocumented second argument `item` to the children function:

```auto
children: function(done, item) {
    $.getJSON('/some/url', function(result) {
        done(result);
    })
}

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 May 2022 18:26 UTC](https://discourse.nodered.org/t/recursive-treelist/59543/3 "2022-05-07T18:26:54Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
