How do I disable drag and drop on a dragObject after the drop?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How do I disable drag and drop on a dragObject after the drop?

Steven Mitchell
See http://www.byteworksinc.com/dojoDragAndDrop.html.  It is a dual select list where I drag a li element from one ul and drop it on another ul.  How do I turn off drag and drop for a dragObject after I drop it on the target?  I tried:

dojo.event.connect( "after", dragSource, "onDragEnd", function(e)
{
    dragObject.domNode.unregister(); // Don't do what I want
});

but that abruptly ends  the animation, leaves the node label frozen on the screen, and fails to prevent dragging. Dynamically changing the node's id has the same effect. I Googled on "dragObject disconnect" and did not find anything useful.

Thoughts?

_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I disable drag and drop on a dragObject after the drop?

Thomas Wolf
Steven Mitchell wrote:

> See http://www.byteworksinc.com/dojoDragAndDrop.html.  It is a dual
> select list where I drag a li element from one ul and drop it on another
> ul.  How do I turn off drag and drop for a dragObject after I drop it on
> the target?  I tried:
>
> dojo.event.connect( "after", dragSource, "onDragEnd", function(e)
> {
>     dragObject.domNode.unregister(); // Don't do what I want
> });
>
> but that abruptly ends  the animation, leaves the node label frozen on
> the screen, and fails to prevent dragging. Dynamically changing the
> node's id has the same effect. I Googled on "dragObject disconnect" and
> did not find anything useful.

It should work to add:
dojo.dnd.dragManager.unregisterDragSource(e.dragSource);
to your onDrop function. Not sure about your
removeEntitlement() code, I think you'll have to re-register
the drag-source in any case (not just for IE) and it
currently throws an error in Firefox...

HTH
Thomas


_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
ben
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I disable drag and drop on a dragObject after the drop?

ben
This post has NOT been accepted by the mailing list yet.
Thomas Wolf wrote
...
It should work to add:
dojo.dnd.dragManager.unregisterDragSource(e.dragSource);
to your onDrop function. Not sure about your
removeEntitlement() code, I think you'll have to re-register
the drag-source in any case (not just for IE) and it
currently throws an error in Firefox...

HTH
Thomas
Hi All,

how do achieve the same behaviour in dojo 1.8?
I had a look at the dojo/dnd/Manager but the manager doesn't anything similar.
So after I create a dnd Source, how can I programmatically disable or destroy that source?

Thanks a lot,

Ben
Loading...