I noticed that when auto-scheduling is turned on when you move a task into the future, the system automatically changes the constraint type to “Start No Earlier Than”. How can I override this behaviour and deny the move and keep the constraint type “Start ASAP”?
Hello Jon,
You can change the constraint type in the onAfterTaskDrag
event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onaftertaskdrag_event.html
After that, you can apply the gantt.autoSchedule(id);
command to auto-schedule the task according to its new constraint type:
https://docs.dhtmlx.com/gantt/api__gantt_autoschedule.html
Here is the code that you need to add:
gantt.attachEvent("onAfterTaskDrag", function(id, mode, e){
var task = gantt.getTask(id);
task.constraint_type = 'asap';
gantt.autoSchedule(id);
});
And here is the snippet that demonstrates how it works:
http://snippet.dhtmlx.com/2d0a53ca7