Created
October 26, 2009 09:28
-
-
Save jakearchibald/218534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mySortable = new glow.widgets.Sortable('#mySortable', { | |
onSort : function () { | |
// this will contain the IDs of the items in the sortable, in order | |
var itemIds = []; | |
// get the children of the sortable containers - these are the items you drag | |
// Then sort them, and get the ID for each | |
mySortable.containers.children().sort().each(function () { | |
itemIds.push( this.id ); | |
}); | |
// send the order of the boxes back to the server | |
glow.dom.get('/saveorder.php?order=' + itemIds.join('|'), { | |
onLoad: function (response) { | |
// obviously you wouldn't really want to alert every time this worked | |
alert('Order sent to server'); | |
}, | |
onError: function (response) { | |
alert('Uh oh, something went wrong'); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment