taskParent

Returns the parent task of a certain task.

Parameters

task kendo.data.GanttTask

The reference task.

Returns

kendo.data.GanttTask—The parent task.

Example - get the parent of a task

<script>
  var dataSource = new kendo.data.GanttDataSource({
    data: [
      {
        id: 1,
        orderId: 0,
        parentId: null,
        title: "Task1",
        summary: true,
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      },
      {
        id: 2,
        orderId: 0,
        parentId: 1,
        title: "Task2",
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      }
    ]
  });

  dataSource.fetch();

/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(dataSource.taskParent(dataSource.at(1)).title) // outputs "Task1"
</script>

Example - get the parent of a root-level task

<script>
  var dataSource = new kendo.data.GanttDataSource({
    data: [
      {
        id: 1,
        orderId: 0,
        parentId: null,
        title: "Task1",
        summary: true,
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      },
      {
        id: 2,
        orderId: 0,
        parentId: 1,
        title: "Task2",
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      }
    ]
  });

  dataSource.fetch();

/* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(dataSource.taskParent(dataSource.at(0))) // outputs "null"`
</script>
In this article