Hi,
I want custom DnD control. I donot want to drag “Part 2”. When I drag any one item, it is working fine. But when I drag multiple items, I’m not getting the mutiple Id’s. This is my code.
Custom Behaviour for DnD <link rel="stylesheet" type="text/css" href="./samples/common/samples.css">
<script src="./samples/common/treedata.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class='webix_full_screen'>
<div class='header_comment'>Custom drag-and-drop behaviour</div>
<div id="testA" style='width:300px; height:300px'></div>
<hr>
<div id="myDrag" style='width:200px; height:100px; border:2px outset silver;'>Drag me to the component</div><br>
<div id="myDrop" style='width:200px; height:100px; border:2px outset silver;'>Drag something from the component here</div>
<script type="text/javascript" charset="utf-8">
webix.ready(function(){
treea = new webix.ui({
container:"testA",
view:"tree",
select: true,
multiselect:true,
drag:true,
data: webix.copy(smalltreedata)
});
webix.DragControl.addDrag("myDrag",{
move:function(source, target, obj, details){
obj.add({
value:"new item"
}, target, details.parent);
obj.open(target);
}
});
webix.DragControl.addDrop("myDrop",{
$drop:function(source, target){
var dnd = webix.DragControl.getContext();
if (dnd.from.name){ //ignoring non-ui dnd
var value = dnd.from.getItem(dnd.source[0]).value;
target.innerHTML=value;
}
}
});
treea.attachEvent("onBeforeDrag", function(context, ev) {
var id = context.source;
var tree = this.getItem(id);
webix.message(tree.value);
if (tree.value === 'Part 2') {
return false;
}
return true;
});
});
</script>
</body>
Please help me!!!
Thanks,
Siva