itemsTree

Builds and returns an items tree.

Parameters

item kendo.data.OrgChartModel (optional)

The parent item for which the tree should be created. If this parameter is not specified, the tree will be build for the entire source.

Returns

Array An array featuring the tree-like hierarchy in the source.

Example

<script>
  var dataSource = new kendo.data.OrgChartDataSource({
      transport: {
              read: {
              url: "https://demos.telerik.com/kendo-ui/service/EmployeeDirectory/All",
              dataType: "jsonp"
          }
      },
      schema: {
          model: {
              id: "EmployeeId",
              parentId: "ReportsTo",
              fields: {
                  EmployeeId: { type: "number", nullable: false },
                  ReportsTo: { field: "ReportsTo", nullable: true },
                  title: { field: "Position", nullable: true },
                  name: { field: "FirstName", nullable: true }
              },
              expanded: true
          }
      }
  });

    dataSource.read().then(function() {
      var tree = dataSource.itemsTree();

      console.log(tree);
    });
</script>
In this article
Not finding the help you need? Improve this article