An absolutely common sortable case:
<script>
$(function() {
$("#sortable").sortable();
});
</script>
<ul id="sortable">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Problem. Need to cancel dragging of an item on some condition and there is a good advice of Andrew Whitaker, but that approach is working only for jquery-ui-draggable and fails for sortables:
$("#sortable").sortable({
start: function() {
return false; // will still cause `this.helper is null`
}
});
Will be greateful for suggestions.
The
sortfunction callback does the same for sort as drag for draggable (demo):