onRowDragEnd

fires after the user drops a vertically reordered row in the grid

void onRowDragEnd(string|number id,string|number target);
idstring|numberthe id of the task that the user has dragged vertically in the grid
targetstring|numberthe id of the task which place the dragged row has occupied

Example

gantt.attachEvent("onRowDragEnd", function(id, target) {
    //any custom logic here
});

Related samples

Details

The event is fired when a task is moved by the mouse pointer in the left-hand grid, while the order_branch setting is enabled. If branch reordering is disabled, the event will never be called.

The target parameter will contain the id of the nearest task that goes right before or right after the current task.

Its value may come in one of two formats:

  • target=targetId - the current task should go right before the targetId task
  • target=next:targetId - the current task should go right after the targetId task (occurs if you replace the last task in the chart)

An example of getting the id of a target in the next:targetId format:

gantt.attachEvent("onRowDragEnd", function(id, target) {
    if(typeof(target) === "string"){
        targetTaskId  = target.substr("next:".length);
        nextTask = true;
    } else {
        targetTaskId  = target;
        nextTask = false;
    }
});
See also
Back to top