Reputation: 210
I am doing something like http://jqueryui.com/demos/sortable/#display-grid using jQueryUI Sortable. However, I was wondering if there is a way to change the position of the dragged item and the dropped position instead of sorting them.
For example, in a 3x3 grid below
1 2 3
4 5 6
7 8 9
if I drag grid 1 to grid 4, jQuery-sortable by default, would have the new positions as
4 1 2
3 5 6
7 8 9
However, I would like it to be
4 2 3
1 5 6
7 8 9
Is there a way to do that by hooking onto some events or via some hack?
Upvotes: 1
Views: 993
Reputation: 1126
Maybe you should have a look at the jQuery swapable plugin. I haven't used it myself, but it seems to do what want. Look at the grid demo.
Upvotes: 1