Can jQuery UI's Sortable handle complex selectors for the items option?

Posted by jverdi on Stack Overflow See other posts from Stack Overflow or by jverdi
Published on 2010-05-27T02:47:28Z Indexed on 2010/05/27 2:51 UTC
Read the original article Hit count: 223

I have list items in an unordered list that when double clicked, can be edited in place via a wysiwyg editor.

$('ul.mtm_section').sortable({
  disabled: true,
  distance: 10,
  items: '> li:not(:has(form))'
});

My goal is to prevent the list item from being sorted while it is being edited - aka once a form element has been swapped in place of the contents.

Unfortunately my selector for items is not working. Is sortable able to handle complex selectors like these? If not, are there other clever means to disable some items from being sortable, perhaps a callback function?

I would prefer to rely on this sortable option, as the wysiwyg plugin is deeply nested with jEditable and as far as I know does not open up any events for me to hook into.

Using jQuery 1.4.2 and jQuery UI 1.8.1

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery