jQuery 1.3 With PHP: chp8, drag/drop
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.
update: I fixed Sortable. Here’s an example of nested sortables using the corrected code: demo.
Kae, this is great stuff, I really can’t wait for the book. Have you started redeveloping kfm yet? I found a post about how to use it with Expression Engine, I have to test that!
haven’t started the redevelopment yet. my plan is to finish the book, and then hopefully promote a new book to Packt titled “File Management with PHP and jQuery” which will be used to help rewrite KFM and explain how it works.
Even if they don’t go for it, I’ll write it anyway – I like how Padraic wrote a book on Zend and published each chapter on his site as he wrote it, so I may try that as well.