After writing my previous post about “Keeping track of indexes while dragging in jQuery UI Sortable” I received a question about how this would work for sortable table rows. The code I included in the previous post should actually be enough to make everything work (.. as long as I understood the question correctly). I’ve created a minimal example as a complete implementation of the code from the previous post, and I’ve also included it as a live demo here.
This is based on jQuery 1.5.1 and jQuery UI 1.8.13. I’ve simply used the distribution versions of this example (you probably want to build your own UI bundle using the interface on the jQuery UI website).
Here’s a live demo that you can play with.
Inline javascript and WordPress could possibly be better friends.
The complete source for the minimal (but complete) example is included here:
jQuery UI Example Page
- Dragging from index
- None
- Hovering index
- None
Keys | Values |
---|---|
Key 1 | Value 1 |
Key 2 | Value 2 |
Key 3 | Value 3 |
Key 4 | Value 4 |
Key 5 | Value 5 |
Key 6 | Value 6 |