How to move a regular task into an othe regular task ?

Hello all,

I’m searching about the best way to programatically move a task (A) inside an other task (B). I want to make (B) a parent of (A).
How can I do this in Javascript only ?

Thanks for your help.

Hi,
You can change the value of ‘parent’ property of the task object. Then you’ll need to call ‘gantt.updateTask’ to recalculate the inner state of the task and redraw the gantt:

gantt.getTask(22).parent = 13; //assign new parent id gantt.updateTask(22); // recalculate gantt.render() // redraw

Thank you Aliaksandr !
I’ve missed up the ‘updateTask’ in my attempts…
Your code work perfectly.