I have set up a “Recycle” node on my tree so that if you drag an item into it, it shall delete. However I need a confirm box to show, i am using the following code:
myDataProcessor.setOnBeforeUpdateHandler(function(nodeId,cType){
return confirm(“Are you sure you want to " + cType + " this item?”) ;
});
However if I select CANCEL it still runs the update and deletes the item.
How can I pass the return value and cancel the update?
Thanks
John
a) you need to update to latest version of dataprocessor ( contact us directly at support@dhtmlx.com ), in which next code will work
myDataProcessor.setOnBeforeUpdateHandler(function(nodeId,cType){
if (!confirm(“Are you sure you want to " + cType + " this item?”)){
myDataProcessor.setUpdated(nodeId,false);
return false;
} else
return true;
});
or you can use onDrag event instead of onBeforeUpdate, and add confirmation to that event