Disable specific drag element

I found a nice script, http://mjsarfatti.com/sandbox/nestedSortable/ , which is almost perfect for me. I just can't find one little thing.

I want to disable some of the drag and drop items. I looked in the readme, tried some options but didn't get what I wanted.

Can anyone tell me how can I disable the element that needs to be dragged?

+3


source to share


2 answers


All instructions are here http://jqueryui.com/sortable/#items

In your code I have extracted and posted here http://jsfiddle.net/axgTF/1/

change

items: "li",

      

to



items: "li:not(.dontsortme)",

      

and add this class to the items you want to disable from sorting eg.

<li id="list_10" class="dontsortme"><div><span class="disclose"><span></span></span>Item 5</div>

      

What you can see here http://jsfiddle.net/axgTF/2/ (clause 5 is disabled)

+7


source


Add the class as static

in items <li>

that shouldn't be moved and then in the config nestedSortable

specify items: 'li:not(.static)'

.

Demo: Fiddle .



There Item 5

can not be moved.

+1


source







All Articles