Andrew dh
Andrew dh

Reputation: 879

jQuery Sortable not working for nested elements

I'm trying to get jQuery sortable to rearrange a div nested hierarchy. My divs can have child divs, that can be ordered or dragged outside the parent so they become siblings etc.

I have an example at: http://jsfiddle.net/xu7xN/

that basically has this layout:

<div id="root">
    <div class="box">
        <div class="header">box a</div>
        <div class="content">
            <div class="box">
                <div class="header">box b</div>
                <div class="content"></div>
            </div>
            <div class="box">
                <div class="header">box c</div>
                <div class="content"></div>
            </div>
        </div>
    </div>
    <div class="box">
        <div class="header">box d</div>
        <div class="content"></div>
    </div>
</div>

Using the connectWith option, I should be able to:

I thought this would be easy but I thought wrong, is there something obviously wrong that I'm doing?

Upvotes: 1

Views: 911

Answers (1)

lewis
lewis

Reputation: 253

This blog post looks like it covers a similar issue and resolves it. It's based around lists instead of divs but the code should still apply jQuery UI nested sortables

Upvotes: 1

Related Questions