Hello all,
I would like for drag and dropping of tasks to be treated as any other. I checked the output of gantt.getUndoStack() and determined that dragging and dropping tasks does not affect the undo stack. I also had a look through codebase/sources/ext/dhtmlxgantt_undo.js and wasn’t able to find any hooks into the onRowDrag events. Would there be interest in accepting patches to the undo module to get this to work, assuming I haven’t missed something?
Hello Frank,
I confirm that the extension doesn’t watch vertical drag and drop changes. We’ll add it to our tracker and probably start working on it in a couple of days. So if you have the patch already, please post it here and I forward it to the developers. Although I cannot guarantee that it will be fully or partially included into the codebase, developers might find interesting ideas how to implement it. So it will be helpful and would show a right direction. Also, if there are other people who need it, they can apply the patch manually to the current or older versions. We appreciate your efforts.
Update:
The Undo extension should watch the reorder events since the 5.2 version.
You can check how it works in the latest Gantt version: https://snippet.dhtmlx.com/s4i5ay4b
I was using the wrong terminology- what I’m actually interested in hooking is the onAfterTaskMove event. Also, I’m interested in whether the Undo stack can be modified to store a “changed” field so that I can fire API calls just for what’s changed.
Hello Frank,
Could you give an example how it can be used? The undo extension watches over the actions in the gantt chart, not over API calls.
And as I said in the previous message, Gantt doesn’t watch vertical task moves. onAfterTaskMove is an event so Undo doesn’t watch it. But if you want to hook it and execute some code, it works. In the following snippet you can see that after you move task manually or via button, you will see a popup message: snippet.dhtmlx.com/8a0367551
I think it is not necessary to modify undo stack because it already stores the information before the task was changed and after the task was changed. You can get the values for example like this:
var custom_variable = gantt.getUndoStack()[0].commands