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 }
});
See Question&Answers more detail:os