Front end not sending request to server when reordering tasks

Hi,

I already added order and sortorder fields in my API’s endpoint but I noticed that the Gantt itself is not sending any server requests when the user reordered some tasks. My code is as follow:

gantt.config.xml_date = "%Y-%m-%d";

  // Task reordering
gantt.config.sort = false;
gantt.config.order_branch = true;
gantt.config.order_branch_free = true;

gantt.init("gantt_here");

gantt.load("/api/v1/tasks);

var dp = gantt.createDataProcessor(function(entity, action, data, id) {
        var server = "/api/v1/";
        switch(action) {
            case "create":
                return gantt.ajax.post({
                    url: server  + entity,
                    data: data
                });
                gantt.refreshData();
                break;
            case "update":
                return gantt.ajax.put({
                    headers:{
                      "Content-Type":"application/json"
                    },
                    url: server  + entity + "/" + id,
                    data: JSON.stringify({
                      id: data.id,
                        task: data
                    })
                });
                break;
            case "delete":
                return gantt.ajax.del({
                    url: server + entity + "/" + id
                });
                break;
		}
	});

Am I missing something?

Hello @keithmanilla ,

It appears to be a bug on our end, thank you for reporting it. I’ve submitted it to our internal tracker, and the dev team has started fixing it and it will be published with the next bugfix release.
Now, as a workaround for the issue, you manually trigger the update by calling gantt.updateTask() after task is moved to a different position:

gantt.attachEvent("onRowDragEnd", function(id, target) {
    gantt.updateTask(id);
});

Here is a working snippet:
http://snippet.dhtmlx.com/10adf978e

And here are the related docs
https://docs.dhtmlx.com/gantt/api__gantt_updatetask.html
https://docs.dhtmlx.com/gantt/api__gantt_onrowdragend_event.html

1 Like

Thanks @guldmi,

I tried it but Im getting paused in the debugger.

When will the bug fixes be available? Im currently using 6.1.5.

Hi @keithmanilla !
The bugfix will be out around 13-14th of May