Our state of the art Gantt chart


Post 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/

Best regards,
Márcio


Post 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.

All the best,
Alex


Post by chenghuang »

Hmm, so we can't customize the project start time before the task start time?


Post 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:


Post 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.


Post 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.

All the best,
Alex


Post 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.


Post 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
			}
		}
	}
},

Best regards,
Márcio


Post 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}
        />

Post 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.

All the best,
Alex


Post Reply