registers drag area
node | id|HTMLElement | html node or ID |
ctrl | object | object code of the drag control methods |
<div id="myDrag"><div>
webix.DragControl.addDrag("myDrag",{
move:function(source, target, obj){
var index = -1;
if (target)
//defining position of the target item
index = obj.getIndexById(target);
obj.add({
title:"new item",
rank: "0"
}, index);
}
});
When a draggable div with myDrag ID is dropped over the datatable item, it takes its place (defined by index). If index cannot be retrieved, the item takes the last position and is added to the end of the datatable.