O'Reilly logo

Beginning JavaScript® and CSS Development with jQuery by Richard York

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix K. Sortables

Method

Description

Return Value

Sortable Methods

sortable(options)

Makes the selected element(s) sortable. Options can be specified by passing an object literal as the first argument using key, value pairs. For a complete list of options, see the "Sortable Options" section later in this Appendix.

jQuery

sortable('disable')

Disables sortable functionality on the selected element(s).

jQuery

sortable('enable')

Enables sortable functionality on the selected element(s).

jQuery

sortable('destroy')

Completely removes sortable functionality from the selected element(s).

jQuery

sortable('serialize', options)

Returns a string of serialized IDs for each sortable item, which can then be used in an AJAX request or input form. For a complete list of options, see the "Serialize Options" section later in this Appendix.

String

sortable('refresh')

Refreshes the sortable items.

jQuery

sortable('refreshPositions')

Refreshes the cached positions of sortable items.

jQuery

Sortable Options

Option

Description

Type

appendTo

Defaults to the parent; defines where the helper that moves with the mouse is being appended to during the drag (e.g., to resolve overlap/zIndex issues).

String

axis

If specified, the items can only be dragged along either the X- or Y-axis. Only allows the values x or y.

One of x or y

cancel

Prevents sorting from beginning on elements that match the selector.

Selector

connectWith

Accepts an array of selectors, where the selector(s) match elements that are sortable elements. If this option is specified, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required