Update end date and duration

Hi,

I need to update Gantt duration when updating the end date and update end date when updating the duration (sync duration and end date when either duration or end date changed).

Also I need to apply below logics.

  1. Make holidays not selectable in both start and end date in inline editors.
  2. When start date and end date is same, duration should be 0

I referred the below snippet sample and found that above point 1 is not working and when the start date and end date is equal, duration displays as 1.

https://snippet.dhtmlx.com/5/6408aee00

Thank you.

Hello Madhuka,

I need to update Gantt duration when updating the end date and update end date when updating the duration (sync duration and end date when either duration or end date changed).

Gantt already does that out of the box if you modify tasks from the UI. If you do that with the Gantt API, you need to manually update the duration or end_date.


Make holidays not selectable in both start and end date in inline editors.

Gantt uses the input element with the date type for the inline editor with the date type. There is no built-in way to disable selecting the weekends from the element that is rendered by the browser.
You will need to create a custom inline editor and implement a custom solution:
https://docs.dhtmlx.com/gantt/desktop__inline_editing.html#custominlineeditor

I have the following examples that can help you to start:
http://snippet.dhtmlx.com/39f093026
http://snippet.dhtmlx.com/5/16401260e
If you want us to implement a custom solution for you, you can contact the Sales team:
info@dhtmlx.com


When start date and end date is same, duration should be 0

That should work that way out of the box. Here is an example:
https://snippet.dhtmlx.com/fvik872l

1 Like