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

Hello,
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:
https://snippet.dhtmlx.com/a46c51xb

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

Hello,
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:
https://docs.dhtmlx.com/gantt/api__gantt_ontaskclick_event.html
Here is an example:
https://snippet.dhtmlx.com/7gga04xa

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:



https://docs.dhtmlx.com/gantt/api__gantt_task_attribute_config.html

You can use the gantt.utils.dom.closest method to obtain the related DOM element:
https://docs.dhtmlx.com/gantt/api__gantt_utils_other.html#:~:text=HTMLElement%20domHelpers.closest

Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/o9xwq24x

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

image

Hello,
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:
https://docs.dhtmlx.com/gantt/desktop__multiple_gantts.html

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:
https://docs.dhtmlx.com/gantt/desktop__gantt_instance.html

Here are the Vue3 demos:

Gantt Instance approach:
https://files.dhtmlx.com/30d/4f25d33cbc4b19057f40a028577f9410/vue3+gantt-instance+trial_7.1.12.zip

Alternative approach:
https://files.dhtmlx.com/30d/ba3be5b2fbffd3484af6c2da06ba653e/vue3+gantt.zip

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