The Gantt scheduling engine will update start and end dates of automatically scheduled events based on their constraints, links and position in the task hierarchy. This means that the startDate and endDate will be revalidated and might be recalculated as soon as the event is added or loaded to a project.
Re: [REACT] Can't init project startDate
Posted: Mon May 15, 2023 3:16 am
by chenghuang
Hmm, so we can't customize the project start time before the task start time?
Re: [REACT] Can't init project startDate
Posted: Mon May 15, 2023 1:17 pm
by arcady
Yes you can. Yet tasks are scheduled ASAP so if you want a task to be delayed from the project start date the task should either:
Hmm~, this doesn't look like what I want. The situation I am currently encountering is that after I create the first task, I select the start time of the current task. When assigning start times to other tasks later, any start time earlier than the first task is disabled. And what I want to achieve is that I define the start time of this project when I initialize the Gantt chart at the beginning, instead of defining the start time through the first newly created task.
Yes, I have seen it. And I also implemented the custom project start time in the toolbar that you mentioned in the demo. But what I hope is that the project start time can be customized during initialization, which saves the need to select the project start time when starting a new project.
Re: [REACT] Can't init project startDate
Posted: Mon May 22, 2023 2:50 pm
by marcio
Hey chenghuang,
You can use the following listener to set the start date of the project during the initialization
new Gantt({
project : {
// ...
listeners: {
load: ({source}) => {
source.startDate = new Date() // Change to the desired date here
}
}
}
},
Re: [REACT] Can't init project startDate
Posted: Mon May 29, 2023 7:32 am
by chenghuang
I wrote the following code refereeing to your example, but it still doesn't work.
<BryntumProjectModel
tasks = {tasks}
assignments = {assignments}
dependencies = {dependencies}
resources = {resources}
listeners={{
load: ({source}) => {
source.startDate = new Date('2021-02-03') // Change to the desired date here
}
}}
/>
<BryntumGantt
columns={columns}
{...ganttConfig}
/>
Re: [REACT] Can't init project startDate
Posted: Tue May 30, 2023 3:06 pm
by alex.l
Hi, please post the entire app with changes you did. We will debug it to find the problem. It's working well on our side in our demos.