Inline Editing - Changing the end date moves the start date


#1

Thank you for creating a fantastic tool, I have really enjoyed using it. I have a setup with inline editing enabled, and start + end dates loaded. I do not have a duration column, so the system is calculating based on the start and end dates. I have both dates available as columns for editing.
When I edit a task via the drag and drop or the lightbox, everything works correctly. However, if I edit the start or end date inline, on change it will update the opposite date to have the same difference. This seems like it is somehow using the old calculated duration (again I am explicitly not supplying a duration from the database).
Here is the behavior:

Existing Start Date: 2019-04-01
Existing End Date: 2019-06-21

Change end date via inline editor to 2019-06-27

New Start Date: 2019-04-07
New End Date: 2019-06-27

How can I stop it from updating the other date?

Here are my editors and column definitions:

var startdateEditor = {type: "date", map_to: "start_date", min: new Date(2019, 0, 1), max: new Date(2020, 0, 1)};
	var enddateEditor = {type: "date", map_to: "end_date", min: new Date(2019, 0, 1), max: new Date(2020, 0, 1)};
gantt.config.columns = [
		{name: "text", tree: true, width: 240, resize: true, editor: textEditor},
		{name: "start_date", width: 100, align: "center", label: "Start Date", resize: true, editor: startdateEditor},
		{name: "end_date", width: 100, align: "center", label: "End Date", resize: true, editor: enddateEditor},
		{name: "people", width: 50, align: "center", label: "People", editor: peopleEditor},
		{name: "type", width: 100, align: "center", label: "Type", editor: typeEditor},
		{name: "add", width: 44}
	];

Thank you!


#2

Your task duration is 20. So when you change the date it calculate based on duration only.


#3

Hi @braedonsaunders !

You can save start_date and end_date to the global variables using onBeforeEditStart event. And to save changed properties using onSave event.
You can get more information about these events in this article:
https://docs.dhtmlx.com/gantt/api__gantt_ext_other.html

Please check this workaround for the issue:
https://snippet.dhtmlx.com/7409066a3

We’ll add a configuration option for that in the next minor update of the Gantt. After that, the workaround won’t be needed and the issue would be solved by setting the config value. Setting Its value will be an easy way to solve the issue in one line.

I’ll give you an update as soon as it becomes available