index.mustache revision 18f4388f9909487b198704745e4b61f884df1e81
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass<div class="intro">
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass<p> The Sortable Utility allows you to create a sortable list from a container and a group of children. It also allows you to join lists together in various ways.</p>
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass{{>getting-started}}
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass<h4 id="basic">A Basic Sortable List</h4>
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass<p>The most common use case of a sortable list is an Unordered List.</p>
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass<p>Below is the sample markup used to create a `container` and a list.</p>
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass<div id="demo">
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass <li>Item #1</li>
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass <li>Item #2</li>
dbf2c770f8178b12e8fe3c36bfa29df58ef13959Dav Glass <li>Item #3</li>
<p>To turn this into a sortable list, you just need to create the `Sortable` object and tell it the `container` and the `nodes`.</p>
<p>The `nodes` can be any selector string that matches a child of the `container`. For performance reasons you will want to make the `container` an element that is as close to the `nodes` as possible. The farther away in the DOM the `container` is from the `nodes` the worse the performance will be.</p>
var sortable = new Y.Sortable({
<p>Sortable uses `DD.Delegate` under the hood to handle the Drag and Drop operations. It sets itself as the `bubbleTarget` of the `Delegate` instance, so all `DD`-related events are bubbled to it.</p>
<p>For more information on `DD` related events, see the <a href="../dd/#events">events section on the Drag and Drop page</a>.</p>
<p>By default, a `Sortable` list can only interact with itself; you can't drag from one `Sortable` list to another. But a `Sortable` instance can be configured to be joined with another `Sortable` instance.</p>
<p>There are four ways a `Sortable` list can be joined: `inner`, `outer`, `full` and `none` (`none` is the default).</p>
<td>Items in the joined list can be moved into the main list but items in the main list can not be moved to the joined list.</td>
<td>Items in the main list can be moved into the joined list but items in the joined list can not be moved to the main list.</td>
var sortable1 = new Y.Sortable({
var sortable2 = new Y.Sortable({
sortable1.join(sortable2, 'full');
var sortable1 = new Y.Sortable({
var sortable2 = new Y.Sortable({
var sortable3 = new Y.Sortable({
sortable1.join(sortable2, 'inner');
sortable2.join(sortable3, 'outer');
sortable3.join(sortable1, 'full');
sortable3.join(sortable2, 'full');
<p>The `DD.Delegate` object bound to a `Sortable` instance is exposed to allow you to easily attach plugins to a `Sortable` instance.</p>
<p>The `Sortable` instance has a `delegate` namespace, which is a reference to the internal `DD.Delegate` instance.</p>
var sortable = new Y.Sortable({
sortable.delegate.dd.plug(SomeDDPlugin);