How to set gantt project start date

I don’t set the time for the project here. The document says that the earliest time and the latest time of the sub task will be used as the cycle. Why will it go back 100 years? Can you help me? I don’t understand. Thank you

Yes, if a task has the project type, it will depend on the dates of its children.
I couldn’t reproduce the issue in the snippet:

Probably, the issue is related to the Gantt configuration, but it is hard to suggest what might be wrong as I don’t see your code.

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 for your reply. I also want to ask how to get the task information from the click event. The parameters of the row click event are only given the id and e, one is the dom, the other is the click event. There is no way to get the task. I went to check the related api of getTask, and there is no way to get the task through the dom. I am at a loss

To obtain the task you clicked on, you need to use the getTask method. You can get it from the id parameter of the onTaskClick event handler:
Here is an example:

But it is possible to obtain the task ID from the DOM elements. The task row in the grid and task bar in the timeline have the data-task-id attribute that has the task ID:

You can use the gantt.utils.dom.closest method to obtain the related DOM element:

Here is an example of how it can be implemented:

Thank you for your help. I really appreciate it. Recently, I encountered another problem, which is unloading gantt, entering the page, or refreshing. I don’t know how to deal with it. Do you have experience in this? By the way, this is a vue3 project. Here are the codes and errors


First, you need to make sure that your Gantt version allows you to create a new Gantt Instance when you open the page/tab with Gantt:

The Individual and GPL versions don’t have that feature. So if you destroy Gantt, you won’t be able to use it until you reload the page in the browser. In that case, you should use the alternative approach instead of destroying Gantt:

Here are the Vue3 demos:

Gantt Instance approach:

Alternative approach:

If that doesn’t help you, probably the issue is related to the Gantt configuration. But it is hard to suggest what might be wrong as I don’t see your code. In that case, please send me a ready demo so that I can reproduce the issue locally.

Hello, it was Gantt when it was introduced and Gantt when it was used Descrtutor, if you enter the page again, there will be an error. What’s the difference between the specific data reference you provided, instantiation and the direct use of this gantt? How to get the current gantt instance? When updating data, I will clear the data once, which is gantt. clearAll(). If you go to other pages, you can’t get the data processor to uninstall,
This is the file of the Gantt Chart page. I’ll show you the code directly. The data has a request interface
ProjectTrackGantt.vue (47.5 KB)
The following is a screenshot of this page:

In addition, there is a screenshot of an error. It is an error when parsing tasks again. I’m not sure what the reason is. Please help me analyze it. Thank you very much

Sorry for the delay.
If you use the destructor method, you can no longer use Gantt, until you create a new Gantt instance or reload the page.
You can create a new Gantt instance only if you have the Gantt version that allows that. You can check if there is the Gantt object on your page with Gantt. If you have it, you will be able to create a new Gantt instance.

If you import Gantt this way, most likely, you won’t be able to create a new Gantt instance:

import gantt from "dhtmlx-gantt"

To destroy the Data Processor, you need to use the destructor method from the Data Processor object, for example:


If you only clear the data, Gantt should continue working, but you will need to manually detach all event handlers.

The error from the screenshot means there are cycles in the tree structure.
For example, task 1 has the id: 1 and parent: 1 parameter, which means that the task is the parent of itself. And that is not correct
Or you may have something like this:

{id: 1, text: "task 1", parent: 4},
{id: 2, text: "task 2", parent: 1},
{id: 3, text: "task 3", parent: 2},
{id: 4, text: "task 4", parent: 3},

Here, task 1 is a parent for task 2, and in extent, to tasks 3 and 4. But task 4 is the parent of task 1.

Here are more examples:

I see that you modify some parameters with your functions, maybe there is something wrong with it. For example, here you modify the parent parameter:

    const MapIssueData = (data) => {
      return => {
        return {
          /*other properties*/
          users: item.userIds ? getUsersByIds(item.userIds) : [],
          parent: item.parentId ? item.parentId :,
          open: true,

If the task doesn’t have the parent parameter, it will become the parent of itself.
I tried to do something similar in the following snippet:
It is expected that we get the error message in this case.

As I couldn’t reproduce the issue locally with your code, I cannot be sure that you have the same issue. So if the information above doesn’t help you, please send me a ready demo with all the necessary files so that I can reproduce the issue locally. Then I will check what actually happens in your case.

I haven’t seen you for a long time, and I need your help again. This time, the small chart shows the Gantt chart, as shown in the figure:

Click the small button to enlarge the display. All the components here are Gantt Chart components, which have an additional layer of encapsulation. After zooming in, the width of the grid will become larger, but there is a problem with the grid content, which does not occupy the entire space, as shown in the figure:

I don’t understand why. If you adjust the layout, you will have the same problem when refreshing the page,The following is the code section:

When the grid is scrollable, its width depends on the sum of the width of the columns:
To stretch the columns to the available width, you need to use the scrolable: false parameter for the grid in the layout configuration, then Gantt will always stretch columns to fit the available width. But you won’t be able to scroll them.
Another way is to enable the grid_elastic_columns parameter: