Some samples doesn't work as expected?

Hi, I’m trying the Gantt plugin and runing some samples that does what I need, but some ones doesn’t work as I expect, but I don’t know if I am expecting right :slight_smile:

07_grid/02_branch_ordering.html must supposedly restrict to drag tasks only inside the branch, but it doesn’t.

04_customization/19_task_type.html the label says “Tasks with Subtasks automatically become Summary tasks (Projects)” but it doesn’t work in that way. I.e. If I add a new task from Task #3 of Project #1, Task #3 doesn’t convert to project type. Or… does it work only in the initial load? If it’s the expected behavior, how do you add a project type task or convert a standard task to project, as the standard task dialog doesn’t have a type list? Must I use a customized dialog?

Another one. Docs says “[Project Tasks] Depend on children tasks, i.e. if the user drags a child of a project task, the task changes its duration and progress respectively.”

In the related sample 01_initialization/16_projects_and_milestones.html, changing children tasks updates start and finish of parent project task, but not its progress. How do you update the parent progress?

Hello Carlos,

We received a ticket from you in the support system. Let’s continue our discussion there.


For everyone else:

07_grid/02_branch_ordering.html must supposedly restrict to drag tasks only inside the branch, but it doesn’t.

The following article explains how it should work:
https://docs.dhtmlx.com/gantt/api__gantt_order_branch_config.html
With that option enabled, you can reorder tasks while keeping the same tree level, for example, a subtask will never become the parent task. We’ll add a more clear description in the article.

Here is a snippet where you need to confirm the reordering if the parent changes:
http://snippet.dhtmlx.com/6f4041632
And there is another one, where you cannot change the parent:
http://snippet.dhtmlx.com/3b402bdd2

04_customization/19_task_type.html the label says “Tasks with Subtasks automatically become Summary tasks (Projects)” but it doesn’t work in that way. I.e. If I add a new task from Task #3 of Project #1, Task #3 doesn’t convert to project type. Or… does it work only in the initial load? If it’s the expected behavior, how do you add a project type task or convert a standard task to project, as the standard task dialog doesn’t have a type list? Must I use a customized dialog?

There is a bug that will be fixed in future updates. By design, when auto_types option is enabled, it should work this way:
• When you add a subtask, its parent should become a project (if it is a regular task)
• When you delete a subtask and its parent doesn’t have subtasks anymore, that parent should become a regular task.

Now, it works only when you delete a subtask. As a workaround, you can add the following code:

gantt.attachEvent("onAfterTaskAdd", function(id,task){
  var parent = gantt.getTask(task.parent);
  if (!parent.type || parent.type == gantt.config.types.task) {
    parent.type = gantt.config.types.project;
    gantt.updateTask(parent.id);
  }
});

Here is the snippet:
http://snippet.dhtmlx.com/74bf2dbad

Another one. Docs says “[Project Tasks] Depend on children tasks, i.e. if the user drags a child of a project task, the task changes its duration and progress, respectively.” In the related sample 01_initialization/16_projects_and_milestones.html (and other similar ones), changing children tasks updates start and finish of parent project task, but not its progress. How do you update the parent progress?

Parent tasks and project don’t update the progress parameter unless you implement it manually. Here are the examples with that implementation:
https://snippet.dhtmlx.com/767e74b28
https://docs.dhtmlx.com/gantt/samples/08_api/16_dynamic_progress.html
We’ll update the article.