parentNode

The parent of given node.

Parameters

model kendo.data.TreeListModel

The model whose parent must be returned.

Returns

kendo.data.TreeListModel parent of the node.

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 childNode = dataSource.view()[1];
  var parentNode = dataSource.parentNode(childNode);
  console.log(parentNode); // returns the parent node of the passed node
</script>
In this article
Not finding the help you need? Improve this article