You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/crud-task.md
+37-39Lines changed: 37 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,32 +5,31 @@ sidebar_label: "Basic Operations with Tasks"
5
5
6
6
# Basic Operations with Tasks
7
7
8
-
In this chapter you'll learn how to do basic operations with tasks: to create or delete a task, to dynamically update a task's property.
9
-
8
+
In this chapter, you'll learn how to perform basic operations with tasks: create or delete a task and dynamically update a task property.
10
9
11
10
## Adding a new task
12
11
13
-
To add a new task to the Gantt chart, use the [addTask](api/method/addtask.md) method:
12
+
To add a new task to the Gantt chart, use the [`addTask()`](api/method/addtask.md) method:
14
13
15
14
~~~js
16
-
var taskId =gantt.addTask({
17
-
id:10,
18
-
text:"Project #1",
19
-
start_date:"02-09-2020",
20
-
duration:28
15
+
consttaskId=gantt.addTask({
16
+
id:10,
17
+
text:"Project #1",
18
+
start_date:"2027-09-02",
19
+
duration:28
21
20
});
22
21
~~~
23
22
24
23
### Preventing from adding tasks to certain levels
25
24
26
-
A quite easy way to prevent users from adding sub-tasks to a task of a certain level (or based on some other condition) is to hide the 'Add' button through CSS.
25
+
A simple way to prevent users from adding subtasks to a task of a certain level, or based on some other condition, is to hide the 'Add' button through CSS.
27
26
28
-
You can assign a CSS class for each task row using the [grid_row_class](api/template/grid_row_class.md) template:
27
+
You can assign a CSS class for each task row using the [`grid_row_class`](api/template/grid_row_class.md) template:
If Data Processor is enabled, the [updateTask()](api/method/updatetask.md) method will cause the changes to be sent to the server.
60
+
If Data Processor is enabled, the [`updateTask()`](api/method/updatetask.md) method will cause the changes to be sent to the server.
62
61
63
-
After the task is updated, the [onAfterTaskUpdate](api/event/onaftertaskupdate.md) event fires. It can cause other changes, for example, when the auto scheduling is enabled, Gantt will auto-schedule the task and all its successors.
62
+
After the task is updated, the [`onAfterTaskUpdate`](api/event/onaftertaskupdate.md) event fires. It can cause other changes. For example, when auto scheduling is enabled, Gantt will auto-schedule the task and all its successors.
64
63
65
-
If you need just to re-render the changes, call the [refreshTask()](api/method/refreshtask.md) method instead of [updateTask()](api/method/updatetask.md).
64
+
If you need just to re-render the changes, call the [`refreshTask()`](api/method/refreshtask.md) method instead of [`updateTask()`](api/method/updatetask.md).
66
65
67
66
~~~js
68
-
var task =gantt.getTask(10);//->{id:10,text:"Task #10",start_date:"02-09-2020",...}
To delete a task, use the [deleteTask](api/method/deletetask.md) method:
88
+
To delete a task, use the [`deleteTask()`](api/method/deletetask.md) method:
90
89
91
90
~~~js
92
91
gantt.deleteTask(taskId);
@@ -103,16 +102,15 @@ If you don't need to send multiple requests to the server, you can simply disabl
103
102
gantt.config.cascade_delete=false;
104
103
~~~
105
104
106
-
In that case Gantt will send only one request to the server - for deleting just the parent task, while its nested tasks and links will be deleted by the server.
105
+
In that case, Gantt will send only one request to the server for deleting the parent task, while its nested tasks and links will be deleted by the server.
107
106
108
-
The [cascade_delete](api/config/cascade_delete.md) option affects the way of implemeting a backend. Read more in the
107
+
The [cascade_delete](api/config/cascade_delete.md) option affects the way of implementing a backend. Read more in the
109
108
[related section of the Server-side Integration article](guides/server-side.md#cascade-deletion).
110
109
111
110
## Removing all tasks from the Gantt chart
112
111
113
-
To clear the Gantt chart from tasks, call the [clearAll](api/method/clearall.md) method:
112
+
To clear the Gantt chart from tasks, call the [`clearAll()`](api/method/clearall.md) method:
0 commit comments