Opened 7 years ago

Closed 7 years ago

#14896 closed bug (worksforme)

Sortable cancel method not working with :not selector

Reported by: tilwinjoy Owned by:
Priority: major Milestone: none
Component: ui.sortable Version: 1.11.4
Keywords: sortable cancel :not selector Cc:
Blocked by: Blocking:


Sortables cancel option is not working with :not() selector

Here's a small fiddle demonstrating the problem.

The selector used is ':not(.valid)' Expected result is that the last <li> alone should not be draggable, since it doesn't have the 'valid' class. But none of the elements are draggable, even the ones having class 'valid'

Change History (1)

comment:1 Changed 7 years ago by Scott González

Resolution: worksforme
Status: newclosed

That's because the cancel option defines a selector which is run against the element using .closest(). All of the items in your sortable are contained in an element that match your selector. What you want to use is something like ".sortable-item:not(.valid)".

Note: See TracTickets for help on using tickets.