Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Lock an element ?

Open jspaeter opened this issue 10 years ago • 4 comments

Hello everyone. I wonder if it's possible to lock an element in a list.

For example, I've got a list that I can sort : <ul> <li>...</li> <li>...</li> <li class='locked'>...</li> </ul>

I used the filter to my .locked element but the others <li> can be positioned below my .locked element.

Is there a way to prevent this ?

Thanks !

jspaeter avatar Aug 30 '16 10:08 jspaeter

Create example on jsbin.com (draft)

RubaXa avatar Sep 01 '16 07:09 RubaXa

Thanks for your reply. As you can see on this JS Bin I can drag my first li under my .locked li. I'd like to keep my .locked li always at the end of my ul. Is there a way to do this with the library?

jspaeter avatar Sep 02 '16 07:09 jspaeter

It works fine ! Exactly what I need ! Thanks !

jspaeter avatar Sep 06 '16 07:09 jspaeter

onMove:function (evt) {
        if (evt.related)
        {
            return !evt.related.classList.contains('locked');
        }
    }

hope can help you.

Thank you for your solution.

kiyosunsun avatar Dec 28 '18 03:12 kiyosunsun