For chapter 8 of jQuery 1.3 with PHP, I wrote about drag and drop. jQuery has a few different ways to do drag and drop. The most fundamental way is to use the Draggable and Droppable interfaces, but as it happens, most of the things you might want to do with a CMS can be done just with the Sortable interface.
The examples I wrote for this chapter are:
- Sorting a list and saving the result. demo, download
- Sorting a tree-based list (navigation menu, for example) and saving the result. demo, download
- Dragging items from a list of contacts into a list of people to send emails to. demo, download
The second one worried me for a while, as it kept behaving erratically on me – I would sometimes drag an item and it would simply vanish. It turns out that it’s a bug in jQuery UI’s Sortable that should be fixed by the time the book is out, so it will work better then. I’m not worried about its behaviour right now as I’m certain this will be fixed.