Page 2 of 3

Re: [INFO REQ] Start date is fixed

Posted: Wed Oct 05, 2022 12:29 pm
by kamran_mushtaq

I need to change the start data of my tasks/ activities.


Re: [INFO REQ] Start date is fixed

Posted: Wed Oct 05, 2022 3:08 pm
by marcio

Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 06, 2022 6:12 am
by kamran_mushtaq

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


Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 06, 2022 12:16 pm
by kamran_mushtaq

Can you please let me know why I'm seeing this error in console? its from export


Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 06, 2022 3:58 pm
by alex.l

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.


Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 13, 2022 12:27 pm
by kamran_mushtaq

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;

Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 13, 2022 12:49 pm
by tasnim

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


Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 13, 2022 1:28 pm
by kamran_mushtaq

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.


Re: [INFO REQ] Start date is fixed

Posted: Thu Oct 13, 2022 2:40 pm
by tasnim

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


Re: [INFO REQ] Start date is fixed

Posted: Fri Oct 14, 2022 12:25 pm
by kamran_mushtaq

Great Tasnim!
Much appreciated thank you.