Re: [INFO REQ] Start date is fixed
I need to change the start data of my tasks/ activities.
I need to change the start data of my tasks/ activities.
Hey kamran_mushtaq,
You can use https://www.bryntum.com/docs/gantt/api/Gantt/model/TaskModel#function-setStartDate
Hey Marcio,
thank you for the reply, however I'm unable to find how to use it I can see the reference you linked but please can you help me how to use this. I need the start date of my tasks flexible not fixed to some specific value (constraint). I don't want constraints in startDate. Can you please tell me with a code example.
Thank you
Can you please let me know why I'm seeing this error in console? its from export
Hi kamran_mushtaq,
Please read this guide to understand how scheduling works and why startDate of regular task cannot be changed to random value https://bryntum.com/docs/gantt/guide/engine/gantt_events_scheduling
If you want to manually set dates for task, you can set https://bryntum.com/docs/gantt/api/Gantt/model/TaskModel#field-manuallyScheduled to true for that task.
Can you please let me know why I'm seeing this error in console? its from export
We need more context. It sounds like general JS error, maybe bacause of EcmaScript version you specified.
Check StackOverfow? https://stackoverflow.com/questions/38296667/getting-unexpected-token-export
It's sounds not relevant to original question, if you need further assistance with that, please make a new topic for this question and attach a runnable test case to reproduce this problem.
So by setting this manuallyScheduled to true we can change the start date to any ?
Should I have to do it like that or something else?
gantt.project.taskStore.manuallyScheduled = true;
Hi,
So by setting this manuallyScheduled to true we can change the start date to any ?
Yes.
You would need to set it manually for every task.
As an example
gantt.project.taskStore.getById('12').manuallyScheduled = true;
Or you could set it in the JSON data in every task record
Hi Tasnim,
Setting it in json data would be feasible. How can we set it in json data our json data is dynamic which is storing in a JS object.
Hi,
I found a way for you to achieve it. You could use taskStore's https://bryntum.com/docs/gantt/api/Gantt/data/TaskStore#function-forEach method and iterate through every item and set manuallyScheduled
to true
after the data loads (https://bryntum.com/docs/gantt/api/Gantt/model/ProjectModel#event-load)
Here is a sample code snippet for you
new Gantt({
...
project : {
...
listeners : {
load({ source : project }) {
project.taskStore.forEach((item) => {
item.manuallyScheduled = true;
};
}
}
}
});
All the best ,
Tasnim
Great Tasnim!
Much appreciated thank you.