taskTree

Returns a list of all child Gantt tasks, ordered by their hierarchical index (Depth-First). a parent is collapsed, it's children are not returned.

Parameters

task kendo.data.GanttTask (optional)

The reference task. If this parameter is specified, the result will be all child tasks of this task, ordered by their hierarchical index.

Returns

Array—The list of all child Gantt tasks, ordered by their hierarchical index (Depth-First).

Example - get all Gantt tasks

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

  dataSource.fetch();

  // returns a list with all tasks in the following order: [Task1, Task3, Task2]
  var childTasks = dataSource.taskTree();
</script>

Example - get all Gantt tasks when the parent is collapsed

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

  dataSource.fetch();

  // returns a list with two tasks in the following order: [Task1, Task2]
  var childTasks = dataSource.taskTree();
</script>

Example - get all child tasks of the first task ordered by their hierarchical index

<script>
  var dataSource = new kendo.data.GanttDataSource({
    data: [
      {
        id: 1,
        orderId: 0,
        parentId: null,
        title: "Task1",
        summary: true,
        expanded: 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",
        summary: true,
        expanded: true,
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      },
      {
        id: 3,
        orderId: 1,
        parentId: 1,
        title: "Task3",
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      },
      {
        id: 4,
        orderId: 0,
        parentId: 2,
        title: "Task4",
        start: new Date("2014/6/17 9:00"),
        end: new Date("2014/6/17 11:00")
      }
    ]
  });

  dataSource.fetch();

  // returns a list with all tasks in the following order: [Task2, Task4, Task3]
  var childTasks = dataSource.taskTree(dataSource.at(0));
</script>
In this article