问题
Is it possible to lock an item in a Sortable list once it's been dropped?
Basically, I have a sortable list [OBJECT] that the user is supposed to place the objects into steps. The steps are static/not moveable. Like this:
[Step 1] [OBJECT 1]
[Step 2] [OBJECT 2]
[Step 3] [OBJECT 3]
[Step 4] [OBJECT 4]
So lets say I drag object 1 to step 3:
[Step 1] [OBJECT 2]
[Step 2] [OBJECT 3]
[Step 3] [OBJECT 1]
[Step 4] [OBJECT 4]
Now any object that's dragged SHOULD NOT change the position of [OBJECT 1] because it needs to stay at step 3.
Is it possible to lock it?
回答1:
May be 'cancel' option can help ypu.
$( ".selector" ).sortable( "option", "cancel", "a,button" );
Check this link
回答2:
The best way for me to achieve this was to use drag & drop. I explain more about what I did here: jQuery Drag & drop- reorder
来源:https://stackoverflow.com/questions/15976651/jquery-sortable-lock-item