By default a dojo.dnd.Source container allows you to hold Ctrl to duplicate/copy a dragged item rather than just move it.
I know you can set singular=true to stop multiple items being dragged but how do I stop copying? Duplicating items makes no sense in the context of my items (I am making a draggable list for reordering pages on a website menu).
Thanks
I'm unsure if there's a nicer way, but I've always accomplished this by clobbering the copyState
method on the Source instance to always return false
.
If you've got several Sources on the page, you could also elect to dojo.declare
a subclass with the method overridden, or dojo.extend
dojo.dnd.Source
itself to clobber the method in all instances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With