johnyjo,
A few years ago (has it been that long!?) I needed to do just this and came across this thread, which Gregor nailed.
Repeater Drag & Drop Challenge - Implement a Reorder-able List
I adapted that for my needs, which involved a horizontal list of images, scrollable within a window, reorderable, ability to add and remove items, and go somewhere (link) when clicked. Here is a stripped down version of that with images replaced for confidentiality (thanks to super talented photographer, Jill Greenburg). If you click and hold an item for 3 seconds, it will be movable.
DragandDrop_Repeater.rp (1.41 MB)
AxShare Link
The interaction code for all this got pretty complex (as thePsycho79 said) and it’s not perfect, but worked well enough for my purposes at the time. I don’t have time to explain it all, but you can inspect if you like.
I decided I would try to do this in Axure RP 8 “as simply as possible” (ha!) with your .rp file, using just the dynamic panels you have, because RP 8 has added some improvements for dragging I hadn’t played with yet, and to see what could be done without repeater lists (the logic of which can be a lot more difficult to understand.) I came up with a workable solution:
Horizontal_DragandDrop_Reorder_v2.rp (151 KB)
AxShare Link
Still fairly complex, but the gist is to create “slot locations” with hotspots behind your dynamic panels, then move the dp’s to those x-coordinates.
[ul]
[li] When an item is “picked up” by dragging it (onDrag), a “drop slot” hotspot is moved to its starting location to mark the now “empty slot.” [/li][li] Each slot has its own “handler function” in the form of a dp with OnChangeState events.[/li][li] When dragging an item, crossing over a slot triggers the associated handler to take care of the item in that slot, moving it to the empty slot and then moving “drop slot” to its location (because its slot is now empty). [/li][li] Then that handler calls the handler for the next slot over to create a chained series of events that scoots the items over as needed.[/li][li] When the item is “let go” (onDragDrop) it gets moved to the empty slot.[/li][/ul]
I added in a few “indicator” dp’s to show where the slots are located, how the drop slot gets moved, and when the handler dp’s are called. That also helped me debug this thing. (They are redundant with the hotspots, and I could have started with those instead, then added an onLoad : “hide This” event so they were hidden by default.)
This seems to work pretty well, but it is possible to mess it up by dragging an item around back and forth quickly. Some kind of “drop handler” function could help this by ensuring only one item can occupy one slot at a time.