Here's my dilemma - I have a two-column list of elements (styled <div>
s) that I need to make sortable. With elements that live in one or the other column, this is easy - I just set up two columns, place my elements where they need to be initially, mark them as "sortable," and let jQuery do its magic.
However, I have two elements in the list that need to span both columns. This, unfortunately, breaks the usability of the model. If I stick with my standard 2-column setup, I run into situations where the wide elements overlap or underlap with elements in the other column.
I also tried iterating through both columns to reposition elements so there would be no overlap, but then I realized another issue: my second column (on the right) has no knowledge of the elements positioned in the first column (on the left).
Here's a stripped down example of my markup:
<div id="wrapper">
<div id="column-1" class="column" style="width:400px;">
<div id="item-1" class="item" style="width:200px;">
...
</div>
<div id="item-2" class="item wide" style="width:400px;">
...
</div>
<div id="item-3" class="item" style="width:200px;">
...
</div>
</div>
<div id="column-2" class="column">
<div id="item-4" class="item" style="width:200px;">
...
</div>
<div id="item-5" class="item" style="width:200px;">
...
</div>
</div>
</div>
The way this should line up is something like this table:
-------------------
| item 1 | item 4 |
| item 2 |
| item 3 | item 5 |
-------------------
And each item can be dragged and dropped anywhere else, with items 1, 3, 4, 5 moving interchangeably between the two columns, and with item 2 moving up and down as necessary. Realistically, you should also be able to end up with something like this:
-------------------
| item 1 | |
| item 2 |
| item 3 | item 5 |
| item 4 | |
-------------------
But with a standard column model (i.e. the stock jQuery examples, the only resources I can find from several days of Google searches, and every attempt I've made thus far) this won't work.
So what can I do to implement this kind of layout with the jQuery UI Sortable plug-in so I can continue building my UI?