html5sortable icon indicating copy to clipboard operation
html5sortable copied to clipboard

abort sortleave event

Open giacomomasseron opened this issue 4 years ago • 8 comments

Is there the chance to abort the sortleave event and avoid an item from being removed from the list?

giacomomasseron avatar Jul 16 '21 13:07 giacomomasseron

Hey, there is no specific functionality for this. But you should be able to add it to the sortleave event handler.

Did you try a simple event.preventDefault()?

lukasoppermann avatar Jul 20 '21 09:07 lukasoppermann

Hey, there is no specific functionality for this. But you should be able to add it to the sortleave event handler.

Did you try a simple event.preventDefault()?

I've tried to do it as you've said (calling event.preventDefault() on sortleave event). The dragged item is still lost forever (it didn't back to its original position before it is dragged).

firanto avatar Sep 26 '21 20:09 firanto

Hmm, in this case it is really missing. Would you be able to send a PR that adds this functionality?

lukasoppermann avatar Sep 28 '21 07:09 lukasoppermann

how do you prevent the item from being removed in your demo?

ac615223s5 avatar Mar 24 '22 12:03 ac615223s5

@zzaria what specifically are you referring to?

lukasoppermann avatar Mar 24 '22 20:03 lukasoppermann

https://lukasoppermann.github.io/html5sortable/index.html in the first sortable list, the element doesn't disappear when dragged off, it just returns to its original postion when the mouse is released image

ac615223s5 avatar Mar 24 '22 22:03 ac615223s5

any update?

zhixXiang avatar Oct 30 '22 11:10 zhixXiang

No. But I am very happy to accept a PR if you are able to send one.

lukasoppermann avatar Oct 30 '22 12:10 lukasoppermann