Dojo: drag and drop Stop Drag

Posted by Jose L Martinez-Avial on Stack Overflow See other posts from Stack Overflow or by Jose L Martinez-Avial
Published on 2010-05-18T16:32:46Z Indexed on 2010/05/20 2:30 UTC
Read the original article Hit count: 580

Filed under:
|

Hi, I'm trying to use Dojo dnd Source(1.4.2) to create an interface where I can move some objects from a Source to a Target. It is working fine, but I want to change the behaviour in order to execute a check before actually doing the D&D, so if the check fails, an error message is shown to the user, and the D&D is not made. I've tried the following example I found in a blog:

 dojo.subscribe("/dnd/drop", function(source,nodes,iscopy)
 { 
  if (nodes[0].id == 'docs_menu'){
   dojo.publish("/dnd/cancel");
   dojo.dnd.manager().stopDrag();
   alert("Drop is not permitted");
  }
  }
  );

But it fails saying that this.avatar is null. Does anybody know how to do this?

Thanks.

Jose

© Stack Overflow or respective owner

Related posts about dojo

Related posts about drag-and-drop