1 .. title:: MochiKit.Sortable - sortable with drag and drop lists
6 MochiKit.Sortable - sortable with drag and drop lists
14 <ul id="dnd_sortable">
16 <li>pythonmac.org</li>
17 <li>undefined.org</li>
20 <script type="text/javascript">
21 MochiKit.Sortable.Sortable.create('dnd_sortable');
28 MochiKit.Sortable add a new Sortable object to manipulate easily
35 - :mochiref:`MochiKit.Base`
36 - :mochiref:`MochiKit.Iter`
37 - :mochiref:`MochiKit.DOM`
38 - :mochiref:`MochiKit.Color`
39 - :mochiref:`MochiKit.Visual`
40 - :mochiref:`MochiKit.Signal`
41 - :mochiref:`MochiKit.DragAndDrop`
46 MochiKit.Sortable mainly contains the Sortable object offering
47 facilities to manipulate a list and drag its items to reorder it. It
48 can also be serialized for being send to server. It is ported from
51 .. _Scriptaculous: http://script.aculo.us
60 :mochidef:`SortableObserver`:
62 Observer for DragAndDrop object. You normally don't have to access
63 this, only for customization purpose.
66 Available in MochiKit 1.4+
69 :mochidef:`Sortable.create(element [, options])`:
71 Create a new Sortable. Usually you'll call it with a UL element,
72 but it can be customized with options to use something else.
74 You have the following options:
76 ================= ==================
91 onChange MochiKit.Base.noop
92 onUpdate MochiKit.Base.noop
95 ================= ==================
98 Name of the tag used to make the draggable elements. It matches all
99 the childNodes of the Sortable element with this tag.
102 Class or array of classes used to filter the children, combined with
106 Regular expression which serves as a match filter for serialization,
107 on children' ids. For example, with the default value, you'll get
108 ['1', '2', '3', '4'] with ids ['sort_1', 'sort_2', 'sort_3', 'sort_4'].
111 Callback called when an element moves between others in the Sortable.
112 It's called for *each* movements, even if you don't release the mouse.
115 Callback called when the order changes in the Sortable. It's called
116 only if the Sortable is modified, after you dropped an element.
119 Option for creating a Sortable tree. It's an experimental
120 setting, that can be very slow even with a few elements. You
121 can customize its behaviour with the ``treeTag`` option, that
122 defines the node used to make branches in your tree (that
125 Other options are passed to the Draggables and Droppables objects created.
126 Refer to :mochiref:`MochiKit.DragAndDrop` for more information.
129 Available in MochiKit 1.4+
132 :mochidef:`Sortable.destroy(element)`:
134 Destroy a previously created sortable. It prevents further use of
135 the Sortable functionnality on the element, unless recreated.
138 Available in MochiKit 1.4+
141 :mochidef:`Sortable.serialize(element [, options])`:
143 Serialize the content of a Sortable. Useful to send this content
144 through a XMLHTTPRequest. The options overrides the ones of the Sortable
145 only for the serialization.
147 ====== ==========================================
148 tag tag from the Sortable
149 only only from the Sortable
150 name id of the element
151 format format of the Sortable or /^[^_]*_(.*)$
152 ====== ==========================================
155 Available in MochiKit 1.4+
161 - Thomas Herve <therve@gmail.com>
162 - Bob Ippolito <bob@redivi.com>
163 - Originally adapted from Script.aculo.us <http://script.aculo.us/>
169 Copyright 2005 Bob Ippolito <bob@redivi.com>. This program is
170 dual-licensed free software; you can redistribute it and/or modify it
171 under the terms of the `MIT License`_ or the `Academic Free License
174 .. _`MIT License`: http://www.opensource.org/licenses/mit-license.php
175 .. _`Academic Free License v2.1`: http://www.opensource.org/licenses/afl-2.1.php
177 Portions adapted from `Scriptaculous`_ are available under the terms
178 of the `MIT License`_.
180 .. _`Apache License, Version 2.0`: http://www.apache.org/licenses/LICENSE-2.0.html