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 th
I extended the jQuery.Ui.sortable:
jQuery.Ui.sortable widget extension with fixed feature. 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.
https://gist.github.com/3758329#file_fixedsortable.js > fixedsortable.js
http://jsfiddle.net/omnosis/jQkdb/
General:
To use, add the fixed property to the sortable list optios:
$("#list").fixedsortable({
fixed: (value)
})
the value can be:
3[1,2,5]HTML:
//the jquery
//the original jquery-ui
//the extended sortable
...
- oranges
- apples
- bananas
- pineapples
- grapes
- pears
- mango
- bananas
- oranges
- apples
- pineapples
- grapes
- pears
- mango
- bananas
- oranges
- apples
- pineapples
- grapes
- pears
- mango
Javascript
$(function() {
$("#sortable1").fixedsortable({
fixed: "> .static"
});
$("#sortable2").fixedsortable({
fixed: $("li[foo]").css("background","red")
});
$("#sortable3").fixedsortable({
fixed: 2
})
});
Notes:
If you insist to use the .sortable instead of .fixedsortable you can use this https://gist.github.com/3758329#file_sortable.js instead of the jquery.ui library. This is a complete replacement of the jQuery.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..