Semantics of sortable() when jQuery selects multiple elements
I've been looking at using sortable() to sort items across multiple
parents, in principle like this:
<div class="container">
<div class="element">Element 1</div>
<div class="element">Element 2</div>
</div>
<div class="container">
<div class="element">Element 3</div>
<div class="element">Element 4</div>
</div>
jQuery(".container").sortable();
What I want is to be able to rearrange all elements across both
containers, eg. to drop all four into the first container, or to drop
all of them into the last container. Now, jQuery UI's sortable() seems
to keep the containers separate. In the example above, when
jQuery(".container") selects multiple elements, it works as multiple
orderable containers.
Todays implementation, unless there is another way of specifying what
I want, makes this impossible. I would venture that the correct
semantics would be that sortable() ought to make all child elements of
all selected elements sortable across all the selected elements. If
the user wants to keep multiple elements individualle sortable, this
could be be specified using each():
- To sort across all parents: jQuery(".container").sortable();
- To sort individually: jQuery(".container").each(function()
{ jQuery(this).sortable(); });
A good example of how I think this ought to work is availble on
http://host.sonspring.com/portlets/. This is built on the old
Interface library, using $('#columns td').Sortable() to sort portlets
across all table cells.
So two questions:
-> Is it possible to achieve this functionality using the new jquery-
ui sortable() implementation?
-> Is my analysis on how it ought to work correct :-)
/ELY