views:

753

answers:

1

Need a way to allow sorting except for last item with in a list.

Tried using the cancel option but it didn't work and I don't think that's what its for.

I think a solution may be with events but would like your take on it.

In practice the list is dynamically generated and relies on tag and relative referencing not id's for selecting.

Sample code:

$("ul").sortable({});
...
<ul>
<li>red</li>
<li>blue</li>
<li>white</li>
<li>black</li>
<li>this li should not be sorted</li>
</ul>

browser ie6...

Thank you in advanced.

+5  A: 

I'm not sure if what EndangeredMassa posted will work. Try:

$("ul").sortable( { items: "> li:not(:last)" } );
Prestaul