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
The correct way to do this kind of check is to override
checkAcceptance(source, nodes)function indojo.dnd.Source.Refer to the doc for more details.