Premium support for our pure JavaScript UI components


Post by sprabhu »

Hi,
Currently on Gantt Advance example we cant set the Task Start date before the project start date.
To do this we have to first set the Project start date.
We are trying to implement the below functionality,

  1. We can edit a task start date before Project start date. This is trigger a change which will set the Project start date as well.

eg.
Project Start Date: 1/15/2023
Task 1 Date : 1/15/2023

If we change the Task 1 date to 1/1/2023, this should se the project Start date to 1/15/2023 as well.

how can i achieve this?


Post by marcio »

Hey sprabhu,

As you'll see on the source code of the Advanced example, you can use gantt.project.setStartDate(newDate) when editing the field, with that, it'll work as you described.

Best regards,
Márcio


Post by sprabhu »

Yes, but on the Advance example its not working as you mentioned. If the change the start date of Task 'Launch SaaS Product' from Jan 14 2019 and tab out, it get set to Jan 1 2019 again. This is not triggering the Project Start date to set as an 1 2019


Post by tasnim »

Hi,

You could listen to the https://bryntum.com/products/gantt/docs/api/Gantt/data/TaskStore#event-change event
And check when the startDate of a task changes. You could set the project start date with gantt.project.setStartDate(newDate)


Post Reply