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
When user saves the form, you'll need to manually get form values and update the appropriate task using the public API: [addTask](api/method/addtask.md), [updateTask](api/method/updatetask.md) and [deleteTask](api/method/deletetask.md).
131
+
When the user saves the form, you'll need to manually get form values and update the appropriate task using the public API: [`addTask()`](api/method/addtask.md), [`updateTask()`](api/method/updatetask.md), and [`deleteTask()`](api/method/deletetask.md).
135
132
136
-
Note that when a lightbox is triggered by a new task (on clicking the 'plus' button) which should be deleted if the user clicks 'Cancel' to revert the task creation,
137
-
the task object will have the '$new' property set.
133
+
Note that when a lightbox is triggered by a new task, for example by clicking the 'plus' button, and should be deleted if the user clicks 'Cancel' to revert task creation, the task object will have the '$new' property set.
138
134
139
-
You can process lightbox closing, as shown in the example below. The type of an action - 'save', 'cancel' or 'delete' is passed as the "action" parameter:
135
+
You can process lightbox closing, as shown in the example below. The action type, "save", "cancel", or "delete", is passed as the "action" parameter:
140
136
141
137
~~~js
142
-
switch(action){
143
-
case"save":
144
-
task.text='';// apply values from form
145
-
146
-
// add new task or update already existing one
147
-
if(task.$new){
148
-
deletetask.$new;
149
-
gantt.addTask(task,task.parent)
150
-
}else{
151
-
gantt.updateTask(id);
152
-
}
153
-
154
-
break;
155
-
case"cancel":
156
-
// if cancel popup for creating a new task - delete it, otherwise do nothing
157
-
if(task.$new)
158
-
gantt.deleteTask(id);
159
-
break;
160
-
case"delete":
161
-
gantt.deleteTask(id);
162
-
break;
138
+
switch (action) {
139
+
case"save":
140
+
task.text=""; // apply values from form
141
+
142
+
// Add a new task or update an existing one.
143
+
if (task.$new) {
144
+
deletetask.$new;
145
+
gantt.addTask(task, task.parent);
146
+
} else {
147
+
gantt.updateTask(id);
148
+
}
149
+
150
+
break;
151
+
case"cancel":
152
+
// If the user cancels creation of a new task, delete it.
0 commit comments