Is it possible to lock list items in JQuery sortable list in a way that those items will stay in that particular place in the list.
For example,
consider this pseudo list with locked items…
item A
item B(locked)
item C(locked)
item D
item E
item F
item G(locked)
So, I’d like to have the items B,C and G to be fixed in a way that if user drag and drop item D at the start of the list, the item A “jumps” over fixed/locked items B and C with following results…
item D
item B(locked)
item C(locked)
item A
item E
item F
item G(locked)
I’ve been searching for something like this without luck. Is it possible..?
I extended the
jQuery.Ui.sortable:Overview
jQuery.Ui.sortablewidget extension withfixedfeature. This feature allows user to fix elements in the list.With the
.fixedsortable()constructor you construct a.sortable()class which extended with the features. You can use the original methods and the extended as well.Code
https://gist.github.com/3758329#file_fixedsortable.js >
fixedsortable.jsExample
http://jsfiddle.net/omnosis/jQkdb/
Usage
General:
To use, add the
fixedproperty to the sortable list optios:the value can be:
3[1,2,5]HTML:
Javascript
Notes:
If you insist to use the
.sortableinstead of.fixedsortableyou can use this https://gist.github.com/3758329#file_sortable.js instead of the jquery.ui library. This is a complete replacement of thejQuery.ui, but i don’t recommend to use this because of later updates.i have been working on this more than 12 hours 🙁 i am insane..