I have a modelbox for confirmation dialog.When I perform drag&drop for an item/folder from source to target, if that target folder has existed with the same name I am showing one modelbox window with continue/cancel button .But the problem is that the source folder/item is dropped into target one before the model box is appeared.But I need the folder/item should be dropped after continue button is clicked.
When i use the “move()” to drop the item into specified location of subchild, it drops to into the outside of the root folder.How can i drop the item into specified location i.e…item of subchild of the root…How can I traverse to the specified location of “folder”?..
webix.ui({
header: "Folders",
body: {
view: "tree",
id: "folder",
data: treeData,
drag: true,
activeTitle: true,
select: true,
multiselect: true,
on: {
onBeforeDrop: function(context, native_event){
context.parent = context.target;
var targetId = (context.target);
var parentId = (context.parent);
var doDrag = false,haveSameFileName = false;
console.log("parent: "+parentId);
var currentText = this.getItem(context.source).value;
$$("folder").data.eachChild(parentId, function(obj){
if(currentText === obj.value) {
console.log("child: "+ obj.value);
haveSameFileName = true;
}
});
if(haveSameFileName)
{
console.log("Same File Name"+haveSameFileName);
webix.modalbox({
title:"Confirmation Dialog",
buttons:["Continue", "Rename", "Cancel"],
text:"Any content here",
width: "500px",
callback: function(result){
switch(result){
case "0":
var sid=(context.source);
console.log("Continue");
$$("folder").move(sid,0);
break;
case "1":
console.log("Rename");
break;
case "2":
doDrag = false;
console.log("Cancel");
break;
}
}
});
return doDrag;
}
else
{
console.log("HII");
return true;
}
}
return doDrag;
},});
Please help me with this.
Thanks in advance ):-