Our state of the art Gantt chart


Post by kamran_mushtaq »

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


Post by marcio »

Best regards,
Márcio


Post 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


Post by kamran_mushtaq »

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

Attachments
Screenshot 2022-10-06 error.png
Screenshot 2022-10-06 error.png (13.46 KiB) Viewed 168 times

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

All the best,
Alex


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

Post 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


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


Post 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


Post by kamran_mushtaq »

Great Tasnim!
Much appreciated thank you.


Post Reply