You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Possible to disable an <li> from being moved or sorted? #1021
@jad3z Yeah, that's because when preventing sorting in onMove, you are making it not move to the other list, therefore it is never added to it and onAdd never called.
As far as I can tell, Sortable is not really designed for your use case. You would have to add extra logic outside sorting in order for it to work. More specifically, setup drop listeners to tell if the item was dropped on the trash can.
Activity
Fenny commentedon Jan 14, 2017
Same problem here, can't figure it out.
ulken commentedon Jan 14, 2017
To prevent an item from being draggable, use the
filteroption. To prevent it from being sorted/moved, returnfalsefrom within theonMovehandler.Example:
See http://jsbin.com/tuyafe/1/edit?js,output for a more comprehensive example (from the
onMovedocs in the README)Fenny commentedon Jan 16, 2017
Uhm, my disabled item is still being sorted even though it's purpose is to be a static trashcan when the other items are being dragged.
See my example : http://jsbin.com/yepujuv/edit?html,js,output
Hope you can help me out.
ulken commentedon Jan 16, 2017
@jad3z Give this a spin: http://jsbin.com/pebubimuya/1/edit?html,css,js,output
Fenny commentedon Jan 16, 2017
@ulken It stopped from being sorted, but onAdd is not being triggered to delete the item on release.
http://jsbin.com/yepujuv/edit?html,js,output
ulken commentedon Jan 21, 2017
@jad3z Yeah, that's because when preventing sorting in
onMove, you are making it not move to the other list, therefore it is never added to it andonAddnever called.As far as I can tell, Sortable is not really designed for your use case. You would have to add extra logic outside sorting in order for it to work. More specifically, setup drop listeners to tell if the item was dropped on the trash can.
Something like:
See: http://jsbin.com/lefahiyake/edit?js,console,output for a POC