Page 2 of 3

Re: [REACT] Can't init project startDate

Posted: Thu May 11, 2023 10:06 pm
by marcio

Ah, so perhaps you need to add a listener to change the timespan, like the following:

listeners: {
    dependenciesDrawn: ({source}) => {
      source.setTimeSpan(new Date("2019-01-01"));
    },
  },

You can test this snippet here https://bryntum.com/products/gantt/examples/basic/


Re: [REACT] Can't init project startDate

Posted: Fri May 12, 2023 10:52 am
by alex.l

but the task's earliest start time is not necessarily equal to the project start time。

Hi,

In forward direction projects tasks will always start as soon as possible. This means - task's start date will be equal to project's startDate, always, if no other constraints exists.
Please see this guide https://bryntum.com/products/gantt/docs/guide/engine/gantt_events_scheduling

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:


Re: [REACT] Can't init project startDate

Posted: Tue May 16, 2023 4:02 am
by chenghuang

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.


Re: [REACT] Can't init project startDate

Posted: Mon May 22, 2023 8:41 am
by alex.l

Did you see https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#field-startDate ?
In this example https://bryntum.com/products/gantt/examples/advanced/ see Project Start field on the top toolbar, you can manage project's startDate after initialization. startDate of tasks will be adjusted accordingly to Scheduling logic described in the guide I mentioned and Arcady described in his answer.


Re: [REACT] Can't init project startDate

Posted: Mon May 22, 2023 9:45 am
by chenghuang

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.