Author Topic: Feature request: Use childstr function in treeModel  (Read 1897 times)

switchautomation

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 3
    • View Profile
Feature request: Use childstr function in treeModel
« on: November 06, 2018, 11:53:01 am »
Hi
It will be good to use  childstr function in treeModel which return field name with nested objects.
Please implement if it is possible
Thanks


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Feature request: Use childstr function in treeModel
« Reply #1 on: November 07, 2018, 10:14:27 am »
There is already eachChild() method API to iterate through all nested children of a node in the Tree()

https://paramquery.com/pro/api#method-Tree

Hope it helps.

switchautomation

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Feature request: Use childstr function in treeModel
« Reply #2 on: November 08, 2018, 05:58:39 pm »
Thanks for answer
But I mean case when need need tree by different field names with child items.

for example, how to build tree for next object without modifying:

{
   id: 1,
   name: "name 1",
   level1: [{
      id: 2,
      name: "name 2"
   },{
      id: 3,
      name: "name 3",
      level2:[{
         id: 4,
         name: "name 4"
      },{
         id: 5,
         name: "name 5"
      },{
         id: 6,
         name: "name 6",
         level3:[{
            id: 7,
            name: "name 7"
         },{
            id: 8,
            name: "name 8"
         },{
            id: 9,
            name: "name 9",
         }]
      }]
   },{
      id: 10,
      name: "name 10"
   }]
}

Thanks