Sortable methods
The sortables component exposes the usual set of methods for making the component 'do things', and like the selectables component that we looked at before. It also defines a couple of unique methods not seen in any of the other components. The following table lists sortable's full unique methods:
|
Method |
Use |
|---|---|
|
|
Cancels the sort and causes elements to return to their original positions. |
|
|
Triggers the reloading of the set of sortables. |
|
|
Triggers the cached refresh of the set of sortables. |
|
|
Constructs a URL-appendable string for sending new sort order to the server. |
|
|
Serializes the sortables into an array of strings. |
The serialize and toArray methods are great for doing something useful with the resulting post-sort sortables, such as sending the list to a server app. Let's see this in action. In a new file in your text editor, create the following page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org...