This attachment is my modified code。
Support Forum
Hi, I checked your app. You forgot to connect ProjectModel you defined to Gantt. So startDate has been successfully updated, but you can't see that on UI because you didn't use it.
Here is updated code that is working for me in both ways - initial set of startDate
after init, and further updating using the datefield on the toolbar. Please make sure you see difference via gantt.startDate
and gantt.project.startDate
const App = props => {
const project = useRef();
return <>
<BryntumProjectModel
tasks = {tasks}
ref = {project}
assignments = {assignments}
dependencies = {dependencies}
resources = {resources}
listeners={{
dataready: {
fn: ({source}) => {
source.startDate = new Date('2021-02-03') // Change to the desired date here
},
once : true
}
}}
/>
<BryntumGantt
columns={columns}
{...ganttConfig}
project={project}
/>
</>
};
https://bryntum.com/products/gantt/docs/api/Gantt/view/Gantt#config-startDate
https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#field-startDate
All the best,
Alex
Yes, I successfully achieved what I wanted according to your code, but I didn't find the relevant configuration in your code from the document link you gave. I often couldn't find the appropriate configuration options in your documents. This is also one of the reasons why I can't achieve what I want.
Here is docs for dataready https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#event-dataReady
Here is docs for event listeners configs https://bryntum.com/products/gantt/docs/api/Core/mixin/Events#function-on
https://bryntum.com/products/gantt/docs/api/Core/mixin/Events#typedef-BryntumListenerConfig
I hope these are that you missed in the solution we used.
Set project's startDate
in dataready
listener is not a common thing. Since it might be set initially in that case, or in any other callback method using same property gantt.project.startDate
which is documented. I am afraid we cannot add this code snippet to any of configs/props described above.
All the best,
Alex