The first part allows you to transfer the element to a sortable div, which works fine. Then I want this div to become sortable, so I can drag new elements (parts) into it.
This part also works fine, except when you reorder the elements (dark), this will not allow you to insert the part back into it until you reorder them again, or try placing them in one of the other elements and return to it.
It's hard to explain, but here is a screen shot: http://screencast.com/t/Ls2ksVY4Q
The demo is located at: http://jsfiddle.net/9MXWp/
Here is the relevant code:
$(document).ready(function() { $('#the-grid').sortable({ tolerance: 'pointer', update: function(event, ui) { if( $(ui.item).has('.close').length == 0 ) { $(ui.item).prepend('<a href="#" class="close" onclick="$(this).parent().remove();">x</a>'); } $('.part-holder', ui.item).sortable({ tolerance: 'pointer', update: function(event, ui) { if( $(ui.item).has('.close').length == 0 ) $(ui.item).prepend('<a href="#" class="close" onclick="$(this).parent().remove();">x</a>'); } }); } }); $('#sidebar > ul > li.part').draggable({ helper: 'clone', connectToSortable: '.part-holder', addClasses: false }); $('.drag-element').draggable({ revert: 'invalid', helper: 'clone', connectToSortable: '#the-grid', addClasses: false }); $('#update-list').click(updateList); });
A recipe that seems to duplicate the problem (in FF 3.6):
Drag element 1 to the staging area.
Drag element 2 to the intermediate area; place it in front of element 1.
Drag the part inside element 1. β Sometimes the page does not work right here. β β£
Drag the piece inside element 2.
Now drag element 2, which will be after element 1.
β Drag the piece inside element 1; it will not work. β β£
Drag the piece inside element 2; it will work, and now Element 1 will accept the parts again.
ifightcrime
source share