rootNodes

Return all root nodes.

Returns

Array of the root items.

Example

<script>
  var dataSource = new kendo.data.TreeListDataSource({
    data: [
      { id: 1, Name: "Daryl Sweeney", Position: "CEO", Phone: "(555) 924-9726", parentId: null },
      { id: 2, Name: "Guy Wooten", Position: "Chief Technical Officer", Phone: "(438) 738-4935", parentId: 1 },
      { id: 3, Name: "Priscilla Frank", Position: "Chief Product Officer", Phone: "(217) 280-5300", parentId: 1 }
    ],
    schema: {
      model: {
        id: "id",
        expanded: true
      }
    }
  });

  dataSource.read();

  var rootNodes = dataSource.rootNodes();
/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(rootNodes); // returns an array of the root nodes
</script>
In this article