# Editing Dialog

The Gantt provides an option for opening an edit dialog that contains a built-in mechanism for updating the corresponding task and its dependencies.

## Basic Concepts

Each time a task is clicked or double-clicked, the respective [`taskClick`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#taskclick) or [`taskDblClick`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#taskdblclick) event is emitted, and allows you to call a method that will open the edit dialog.

To implement the dialog editing use the following methods and events:

1. When the end user clicks a task in the Timeline pane, this triggers the Gantt [`taskClick`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#taskclick) event.
2. The [`TaskClickEvent`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/taskclickevent) data includes the data item, associated with the clicked task, the `GanttComponent` instance, and the original click event data.
3. To open the task edit dialog, use the Gantt [`editTask`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#edittask) method,

and pass the data item and a [FormGroup](https://angular.io/api/forms/FormGroup) instance containing the editable fields.

1. To process the Gantt data accordingly, use the [`save`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#save) event handler. The [`TaskEditEvent`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/taskeditevent) event data contains the `GanttComponent` instance, the [`TaskEditItem`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/taskedititem), the [`EditEventDependencies`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/editeventdependencies), and the `FormGroup` instance, passed to the `editTask` method.
2. Use the [`closeTaskDialog`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#closetaskdialog) method in the [`cancel`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#cancel) event handler to close the editing dialog without modifying the data. The event is fired when the end user clicks the dialog "close" or "cancel" buttons.
3. Use the [`openConfirmationDialog`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#openconfirmationdialog) method in the [`taskDelete`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#taskdelete) event handler to optionally display a confirmation dialog to prompt the user to confirm deleting a task. The event is fired when the user clicks the "delete" button in the edit dialog or the "delete" icon within each task.
4. Use the [`remove`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#remove) event handler to process the data accordingly when a task is deleted. The event data contains the `GanttComponent` instance, and the [`TaskEditItem`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/taskedititem) to enable updating the parent tasks as necessary.

> All tasks should have valid start and end dates where the end date is after the start date.

The following example demonstrates how to set up and use the edit dialog of the Kendo UI Gantt for Angular using Reactive Forms.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/gantt/editing/dialog/click/source.txt)

## Editing Tabs

The Editing Dialog displays a collection of tabs, containing task-related content, which enables the user to edit the taks's general information, its predecessors and its successors.

### General

The General section of the editing dialog allows users to edit the title, completion ratio, start, and end dates of a given task. To process any changes made by the user, utilize the `FormGroup` instance, provided to the `save` event handler.

### Predecessors

Displays a list of all predecessor dependencies for a certain task. The edit mode allows the user to update a dependency's starting task, associated with the `fromId` field, as well as to create a new dependency or remove an existing one.

### Successors

Displays a list of all successor dependencies for a certain task. The edit mode allows the user to update a dependency's finishing task, associated with the `toId` field, as well as to create a new dependency or remove an existing one.

To process any changes made by the user, utilize the [`dependencies`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/taskeditevent#dependencies) instance, provided to the `save` event handler.

## Editing on Double Click

To open the edit dialog when the user double-clicks a task, replace the `taskClick` event with [`taskDblClick`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent#taskdblclick) in `Step 1` from the [`Basic Concepts`](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/editing/editing-dialog#basic-concepts) instructions.

The following example demonstrates how to open the edit dialog when the user double-clicks a task.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/gantt/editing/dialog/dbl-click/source.txt)

## Suggested Links

* [API Reference of the GanttComponent](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api/ganttcomponent)
* [API Index of the Gantt](https://www.telerik.com/kendo-angular-ui-develop/components/gantt/api)
