New Plan Creation - Default New Task Creation

Dear Community,

We are from FlexiDigit Technologies. We have purchased the Pro version of DHTMX.

We are not able to develop the New Plan Creation with Default Task Creation. Once The new plan is created with that plan new task should be also created by default.

We are not able to achieve this requirement and we need your support on this.

We don’t find any samples on DHTMLX for this.

After Plan creation on the view plan the dummy task created should be listed.

Please support us regarding the above mentioned requirement which we are not able to achieve till now.

Thanks & Regards,
Ramkumar P
Business Analyst
FlexiDigit Technologies

Hello,

You can implement this behavior in DHTMLX Gantt by programmatically adding a default (dummy) task right after creating a new plan. Gantt itself does not automatically generate tasks when a new project or plan is added, but you can handle it using the API.

For example, once you add a new plan, you can immediately call gantt.addTask() to create a child task under it. Here is a simple example:

gantt.init('gantt_here');

function createNewPlan() {
  const planId = gantt.addTask({
    id: gantt.uid(),
    text: 'New Project Plan',
    type: 'project',
    start_date: new Date(),
    open: true,
  });

  gantt.addTask({
    text: 'Default Task',
    start_date: new Date(),
    duration: 2,
    parent: planId,
  });
}
createNewPlan();

Please check an example: DHTMLX Snippet Tool.

This way, whenever a new plan is created, a default task will also be created and shown in the “View Plan”.

Additionally, if you need to show a placeholder row at the bottom of the task list for adding tasks, you may also look into the placeholder_task configuration. It is not the same as automatically creating a default task. It doesn’t automatically create a task with predefined properties when a new plan is created and doesn’t create a hierarchical structure (a parent plan with a child task) by itself. But in some cases, it can help to provide a better user experience.

Best regards,
Valeria Ivashkevich
DHTMLX Support Engineer