Apply changes on custom save button

Hi,

We are using DHTMLX Gantt and using a custom toolbar for save functionality. If we do a change in the Gantt cell and click on save button, changes will not be affected unless we hit enter after making a change in the Gantt cell or click on header cell of the column or click on a different cell.

Please note that we are getting the updated values from “onAfterTaskUpdate” event. Could you please recommend us a way to get the updated content when we click on a custom save button (without hit enter after updating a cell).

Thank you.

Kind regards,
Madhuka Lakshan.

Hello Madhuka,
If you use inline editors, you need to click on a grid cell to edit it. Then Gantt will open the inline editor. When you add or change the value, you make the changes only inside the inline editor element. The task object is not changed until the inline editor is closed. It works that way by design.

You can trigger the gantt.ext.inlineEditors.save method when you click on the Save button:
https://docs.dhtmlx.com/gantt/desktop__inline_editors_ext.html#methods
Here is an example of how it can be implemented:
http://snippet.dhtmlx.com/5/8007c1687

Another way is to not use the inline editors at all. Instead, you can use the template function in the column configuration:
https://docs.dhtmlx.com/gantt/desktop__specifying_columns.html#datamappingandtemplates
With that approach, you can return any HTML elements in the grid and attach custom functions to edit the task object when you edit the HTML elements.

Here is an example of how it can be implemented:
http://snippet.dhtmlx.com/5/37e132b8f

1 Like