Documentation

addDrag

registers drag area

void addDrag(id|HTMLElement node,object ctrl);

Parameters

nodeid|HTMLElementhtml node or ID
ctrlobjecthash code of the drag control methods

See also

Example

<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);
        }
});

Details

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.

Back to top