20
Views
1
Comments
How to use 'zTree'
Application Type
Mobile, Reactive, Service

[zTree Demo Flow]


[My Flow : AppendData Action]


I saw zTreeDemo and understood it.


I tried it once.

In addition to using the AppendData Action recursively like My Flow, is there a simpler way to

add menu rows to zTreeDataList

from data in the Menu Entity?


I converted the Menu list to JSON and put it in MenuListJson (data type: Text). Is there an easy way to use this, or

can I put the data from the Menu entity in zTreeDataList differently from the beginning?


2025-08-07 06-30-56
Amit J
Champion

Yes, there is a simpler and more efficient way to populate zTreeDataList without recursively appending each node—especially since you already have your Menu entity as a flat list and have generated a MenuListJson.

Build zTreeDataList in One Go (using Aggregate or Server Action)

Instead of building zTreeDataList through a recursive AppendData loop, you can use a single loop over the Menu list and construct zTreeDataList records directly.

Example Steps:

  1. Fetch all Menu items into a local list (MenuList).

  2. Use a For Each over MenuList.

  3. Inside the loop, use ListAppend to add a new record to zTreeDataList:

    • id = MenuItem.Id

    • pId = MenuItem.ParentId (or however parent is stored)

    • name = MenuItem.Label

    • open = true or false depending on your tree behavior

This avoids complex recursion while still preparing a flat zTreeDataList that the zTree widget expects.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.