Disbale gantt default feature

Hello Ramil,

I am currently facing this issue, Here I am passing different start_date and end_date from my data source but I am seeing a different gantt_chart Data on the view and I want to disable it.

How Can I achieve this functionality, I want it should plot the gantt

In DHTMLX Gantt, the behavior you’re experiencing, where the start_date and end_date of parent tasks (such as projects or networks) are automatically adjusted to match the earliest start_date and latest end_date of their child tasks (activities), is a default feature. This feature ensures that parent tasks visually encompass the duration of all their child tasks in the Gantt chart view.

How to disable this default behavior

I have use
gantt.attachEvent(“onTaskLoading”, function (task) {
if (task.type === “project” || task.type === “network”) {
task.$no_start = false;
task.$no_end = false;
}
return true; // Make sure to return true to indicate that the task should be loaded
});

gantt.attachEvent(“onTaskCreated”, function (task) {
if (task.type === “project” || task.type === “network”) {
task.$no_start = false;
task.$no_end = false;
}
return true; // Allows the task to be added
});

gantt.attachEvent(“onTaskUpdated”, function (id, task) {
if (task.type === “project” || task.type === “network”) {
task.$no_start = false;
task.$no_end = false;
}
return true; // Allows the task update
});

This code and now in view, It’s taking from data source start_date and end_date, But When I export it, It still goes back to it’s defaullt behavior

Hello Parth,
Right now, there is no built-in way to set custom dates for the project tasks. In the future, the dev team will add that feature, but I cannot give you any ETA.

For now, you can change the task type to task then, parent task will have its own dates:
https://docs.dhtmlx.com/gantt/desktop__task_types.html#regulartasks

If the solution you implemented doesn’t work when you export the data to PDF or PNG, you can export in the raw mode:
https://docs.dhtmlx.com/gantt/desktop__export.html#exportingcustommarkupandstyles

Then Gantt will export tasks using the HTML elements instead of the task data.

If you export to MS Project or Primavera, the type is changed if a task has children.
If a parent task has the task type, it will have a custom the start_date in the Start parameter, but the duration and end_date parameters are ignored by MS Project even if you manually specify the Finish parameter and the parameter is there in the exported file:



Probably, that is how it should work in MS Project, but it is beyond our support, so I cannot suggest if you can configure MS Project to work like DHTMLX Gantt.

Here is the snippet:
https://snippet.dhtmlx.com/5f54qx6n

Thank you ramil for your response, I just have another question, Can I zoom out the raw:true version of exported PDF. Because it’s completing negate the things on the most right.

Please help me with this one

Hello Parth,
It is possible to add these style rules to the header parameter, and it will change the zoom level of the exported content:

    @media print { 
        body,html{
            zoom: 80%;
        }
    }

Here is the snippet:
https://snippet.dhtmlx.com/an6r4a14

But as I don’t know what exactly happens in your case, I don’t know if that approach can help you.

Please add your configuration to the following snippet and make sure that the issue is reproduced there:

Then, click on the Save button and send me the link.
Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.

Thank you Ramil, It was working now as expected, I am really happy with the support you provide

1 Like

Hello Parth,
The dev team added the feature that allows adding custom dates to the project tasks:
https://docs.dhtmlx.com/gantt/desktop__custom_projects_dates.html

You can see how it works in the following sample:
https://docs.dhtmlx.com/gantt/samples/04_customization/25_project_dates.html