views:

19

answers:

1

Hi All, I wanted to know if there is a way I can abort the default drop operation in dojo. I am doing some custom manipulation in the function,

dojo.subscribe("/dnd/drop/before", function(source, nodes, iscopy){
     //Custom manipulation
});

And from this function, I want to cancel the drop, similar to what happens when you press the Esc Key?

Thanks

+1  A: 

You can publish the topic dnd/cancel, i.e. dojo.publish('/dnd/cancel'), then call dojo.dnd.manager().stopDrag() to cancel the drop.

But the recommended way is to customize the checkAcceptance() of dojo.dnd.Source to return false when current node is not droppable. Find more details in dojo dnd's doc.

Alex Cheng