Latest version: 1.3.4 / May 11, 2011
Download the latest version directly from the GitHub page.
For QA, feature requests and general support please visit the nestedSortable forum.
Note: This demo has the maxLevels option set to '3'.
toArray method).
no-nesting in the
above list).
<ol class="sortable"> <li><div>Some content</div></li> <li><div>Some content</div> <ol> <li><div>Some sub-item content</div></li> <li><div>Some sub-item content</div></li> </ol> </li> <li><div>Some content</div></li> </ol>
<div> can be any tag (e.g. <span>), but it has to be some tag. This
same tag has to be set as the 'toleranceElement' in the options, and this, or one of its children, as the
'handle'.
Any <li> can have either one or two tags, the second being <ol>.
tabSize
20
disableNesting
'ui-nestedSortable-no-nesting'
errorClass
'ui-nestedSortable-error'
listType
'ol' (see 1.2 Changelog)
maxLevels
'0' the levels are unlimited.
Default: '0'
noJumpFix
'1' to deactivate the fix (see 1.2.2 Changelog), in case it messes
things up for you. Default: '0'
serialize
key, attribute and
expression).
toArray
setName[n] =>
{
'item_id': itemId,
'parent_id': parentId,
'depth': depth,
'left': left,
'right': right,
}
looking at the items' id's as in serialize.startDepthCount sets the starting depth number (default is 0), expression
is the regex used to extract the number from the item's id (default is the same as
serialize), attribute is the element's attribute that the method will look
at (default is 'id').toHierarchy
'0' ... 'id' => itemId '1' ... 'id' => itemId 'children' ... '0' ... 'id' => itemId '1' ... 'id' => itemId '2' ... 'id' => itemIdSimilarly to
toArray, it accepts the attribute and expression
options.
<ol> containter.
<li> items had the end tag and an element was moved upwards, a text node was
detected as previousItem instead of the correct <li> element.
toArray ran twice through nested items.
maxLevels option.
change event is now correctly triggered.
toArray and toHierarchy inside a change callback function
(and possibly other events' callback functions as well) doesn't result in an error anymore.
toArray method now outputs an ordered array.
toHierarchy method. (Thanks to Milan Petrovic)
serialize and toArray work in IE6+ (In fact,
serialize already worked, but it was badly implemented in this demo page).
<ol>. Since we are dealing with ordering sets of items ordered lists are the way to go
according to HTML specifications.
toArray method (right and left values have
been added, item_id and parent_id are now actual numbers).
serialize and toArray methods.
Text gets ugly when you sort items in some versions of IE, in certain situation. This is a sortable bug.
serialize and toArray in order to have it show the
indentation level, somehow.maxLevel option.
jQuery 1.4+
jQuery UI Sortable 1.8+
Tested with: IE 6, Firefox 3.6, Chrome 10, Safari 3
Will also work with: IE 6+, Firefox 3.5+, Chrome 4+, Safari 3+
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
This work is now pizzaware. If it saved your life, or you just feel good at heart, please consider offering me a pizza. This can be done in two ways: (1) use the Paypal button below; (2) send me cash via traditional mail to my home address in Italy. Is the second method legal? It is in Italy if you use Posta assicurata. You should check with your local laws if you live elsewhere.
© 2010–2012 Manuele J Sarfatti