Error following the steps in the tutorial on Vertical drag and drop task


#1

Hi there,
I have read the drag and drop function in 1 chartt in the example:
https://snippet.dhtmlx.com/50e77fce5?_ga=2.72982165.70767513.1572833766-1718816174.1571628366

when i run the code, is shows up this also in terminal is showing up

‘target_task’ is constant no-const-assign

.


#2

Hi @longhai,
The snippet you use relies on the addTaskLayer method which is available in PRO versions only.
Looks like you’re using a free GPL edition of gantt, which does not have it. That would explain the error you see.
If you have a paid license, you’ll need to replace a free version of gantt with a PRO version in your project.
Currently, we don’t provide npm install for PRO version, so adding a PRO version of gantt to the project would take a couple of manual steps, please check this article on how to do it https://docs.dhtmlx.com/gantt/desktop__install_with_bower.html#addingproeditionintoproject

Another solution I could advise you is to use the custom vertical drag
realization without addTaskLayer method, like this one: http://snippet.dhtmlx.com/7c6fcda72
In this topic you can read more about custom vertical drag and drop solutions:
Vertical drag and drop from the gantt chart area


#3

tks a lot @Siarhei ^^ and have a nice day


#4

@Siarhei in this one : https://snippet.dhtmlx.com/50e77fce5?_ga=2.110570181.1504786938.1573467386-1718816174.1571628366
I edited a bit in ‘data’, didn’t change the code. And as you can see in the image i tag in below this comment : The stage #3 overlap and cover stage # 4.
Any solution disable it? Thanks


#5

Hi @longhai,
To avoid this issue, you should include the “Auto Scheduling” extension(available only in the PRO) and set the auto_scheduling property to true: gantt.config.auto_scheduling = true;
Auto scheduling makes the start date of the second task update according to the end date of the first task each time when it changes.
Note: To make it work, you should also create dependencies between tasks, to make gantt understand how it should schedule them.
Here is corrected snippet:
http://snippet.dhtmlx.com/9e428d720
API:
Auto Scheduling:
https://docs.dhtmlx.com/gantt/desktop__auto_scheduling.html
gantt.config.auto_scheduling:
https://docs.dhtmlx.com/gantt/api__gantt_auto_scheduling_config.html