Adding New Tasks
The Gantt provides an option for adding a new task. Depending on the existence of a selected item, a new item can be added on a root level, above or below the selected item, or as a child of the selected item.
GanttAddTaskComponent is rendered in the Gantt toolbar and represents a
DropDownButton with predefined options and behavior.
Each time the default or any of the actions from the dropdown list is triggered, the Gantt emits the
TaskAddEvent. The event data exposes
the selected item, and the type of action. The built-in types are:
addTask—Indicates there is no selected item.
addChild—Indicates that the new item should be added as a child of the selected item.
addAbove—Indicates that the new item should be added above the selected item at the same hierarchy level.
addBelow—Indicates that the new item should be added below the selected item at the same hierarchy level.
You can handle the
TaskAddEvent and update the Gantt data accordingly, based on the respective action type and selected item.
The following example demonstrates how to add new items to the Gantt.