Is there a way to have nested jQuery sortables? As in nested containers, not in the sense of a nested list.
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="container">
<div class="item"></div>
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="item"></div>
</div>
$('.container').sortable({
connectWith: '.container'
});
That example pretty much works, but when I drop the nested container I get an error:
Uncaught HierarchyRequestError: A Node was inserted somewhere it doesn't belong.
I assume it is because when dragging a container it is positioned under the mouse, so when I drop it, it trys to put it inside itself.
I have a work around, although not ideal so the question still stands.
$('.container').sortable({
connectWith: '.container:not(.ui-sortable-helper)',
tolerance: "pointer",
cursorAt: { left: -50 }
});
Uncaught HierarchyRequestError: Failed to execute 'insertBefore' on 'Node': The new child element contains the parent.- Andy Joneshelper. You may need to clone the helper...$('.container').sortable({ connectWith: '.container', helper: 'clone' });, which of course would need some tweaking. jsfiddle.net/dirtyd77/Px73Q - Dom