onBeforeRowDragEnd
fires when a user drops a row in the grid
boolean onBeforeRowDragEnd(string|number sid,string|number parent,number tindex){ ... };
Parameters
sid | string|number | the id of the task to move |
parent | string|number | the parent id. If specified, the tindex will refer to the index in the 'parent' branch |
tindex | number | the index of the position that the task will be moved from (the index in the whole tree) |
Returns
boolean | defines whether the default action of the event will be triggered (true) or canceled (false) |
Example
gantt.attachEvent("onBeforeRowDragEnd", function(id, parent, tindex){
const task = gantt.getTask(id);
if(task.parent != parent)
return false;
return true;
});
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.
- When event is fired the task is already moved to a new position, but the changes still can be reverted.
- The event is blockable. Return false operation and move task to it's original location
- Original position (parent and index) are available from handler arguments
- Target position can be retrieved from a task object as task.parent and gantt.getGlobalTaskIndex(taskId)
- The parent parameter depends on the set order_branch mode:
- In the regular mode ("true") the parent parameter refers to the original task's parent (the parent of a task before it was moved to a new position).
- In the "marker" mode the parent parameter refers to the new task's parent.
See also
Back to top