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
returnfalse; //denies dragging if the global task index is even
38
34
}
39
-
returntrue; //allows dragging if the global task index is even
35
+
returntrue; //allows dragging if the global task index is odd
40
36
});
41
37
~~~
42
38
43
-
44
39
## Denying dragging tasks out of specific dates
45
40
46
-
To deny dragging tasks out of specific dates, use the [onTaskDrag](api/event/ontaskdrag.md) event.
41
+
To deny dragging tasks out of specific dates, use the [onTaskDrag](api/event/ontaskdrag.md) event.
47
42
48
43
<pstyle="margin-top: 20px; font-weight: bold;"> The onTaskDrag event: </p>
49
44
50
45
<ulstyle="margin-top:5px;">
51
46
<li>Fires each time the user makes a drag movement with the mouse in the timeline area: moves, resizes a task or changes the task's progress.</li>
52
-
<li>The type of a drag movement is passed as the 2nd argument - <b>mode</b>.</li>
47
+
<li>The type of a drag movement is passed as the 2nd argument - <b>mode</b>.</li>
53
48
<li>All available values of the drag movement's type are stored in the [drag_mode](api/config/drag_mode.md) property.</li>
54
49
</ul>
55
50
@@ -59,79 +54,87 @@ To deny dragging tasks out of specific dates, use the [onTaskDrag](api/event/ont
59
54
<li>The user makes a move.</li>
60
55
<li>dhtmlxGantt recalculates the task's date according to the new position.</li>
61
56
<li>dhtmlxGantt fires the [onTaskDrag](api/event/ontaskdrag.md) event.</li>
62
-
<li>dhtmlxGantt re-renders the task in the Gantt chart.<br><i>As the [](api/event/ontaskdrag.md) event fires after dhtmlxGantt makes recalculation,
57
+
<li>dhtmlxGantt re-renders the task in the Gantt chart.<br><i>As the [onTaskDrag](api/event/ontaskdrag.md) event fires after dhtmlxGantt makes recalculation,
63
58
you can specify any custom values for the dragged task in the event's handler, without being afraid that these values will be overwritten. As a result, the task will be rendered in the desired position.</i></li>
64
59
</ol>
65
60
66
-
Let's assume that you want to forbid users to drag tasks out of the **"31 March, 2020 - 11 April, 2020"** interval.
61
+
Let's assume that you want to forbid users to drag tasks out of the **"31 March, 2028 - 11 April, 2028"** interval.
67
62
68
63

69
64
70
65
Then, you can use the code as in:
71
66
72
-
[Denying dragging tasks out of interval - [31.03.2020, 11.04.2020]](Denying dragging tasks out of interval - [31.03.2020, 11.04.2020])
73
67
~~~js
74
-
var leftLimit =newDate(2020, 2 ,31), rightLimit =newDate(2020, 3 ,12);
[Drag parent task with its children](https://docs.dhtmlx.com/gantt/samples/08_api/05_limit_drag_dates.html)
98
-
99
-
100
95
## Dragging children together with the parent
101
96
102
97
To allow dragging children when the user is dragging their parent's task, use the [onTaskDrag](api/event/ontaskdrag.md) event (see more on the event [above](guides/dnd.md#denying-dragging-tasks-out-of-specific-dates)):
## Dragging dependent tasks together with independent tasks
153
154
154
155
There are several ways of implementing tasks moving with their dependent tasks.
155
156
You can read about all of them in a separate article [Dragging Tasks Together with Their Dependent Tasks](guides/dragging-dependent-tasks.md).
156
157
157
-
158
158
## Setting minimal task duration
159
159
160
160
Minimal task duration can be specified via the [min_duration](api/config/min_duration.md) setting.
@@ -164,19 +164,19 @@ The option defines the minimum size of the task that can be set during resizing
164
164
The value is set in milliseconds:
165
165
~~~js
166
166
// 1 day
167
-
gantt.config.min_duration=24*60*60*1000;
167
+
gantt.config.min_duration=24*60*60*1000;
168
168
169
-
//OR
169
+
//OR
170
170
171
171
// 1 hour
172
-
gantt.config.min_duration=60*60*1000;
172
+
gantt.config.min_duration=60*60*1000;
173
173
~~~
174
174
175
175
## Autoscroll during tasks' dragging {#autoscrollduringtasksdragging}
176
176
177
177
If you have a large dataset in the Gantt chart, you often need to drag a task to a new distant position or set links between tasks located at a significant distance.
178
178
179
-
In this case the **autoscroll** functionality is of great help. It is enabled by default, but you can manage this behavior via
179
+
In this case the **autoscroll** functionality is of great help. It is enabled by default, but you can manage this behavior via
180
180
the [autoscroll](api/config/autoscroll.md) configuration option.
181
181
182
182
~~~js
@@ -189,7 +189,7 @@ Besides, you can adjust the speed of autoscrolling in milliseconds with the help
189
189
~~~js
190
190
gantt.config.autoscroll=true;
191
191
gantt.config.autoscroll_speed=50;
192
-
192
+
193
193
gantt.init("gantt_here");
194
194
~~~
195
195
@@ -201,27 +201,28 @@ If you want to prevent certain tasks from being resized, there are two things yo
201
201
In order to do this, you need to use the **task_class** template to add an extra CSS class to the required items so that you could locate them via the selector:
0 commit comments