Switch rank of items

repeater-widget

#1

Hi,

first of all thank you for all your help. My prototype is getting better and better and everybody is impressed of the current results. When it is finished I will share the result with you guys.

But there are still some minor issues I have to solve.

Currently I would like to reorder a list after dragging an item within the same list.
Inpired by another thread I’m changing the items around the dragged one and after that changing the rank of the dragged item itself. This works nice for simple repeaters, but I have an accordion repeater with subitems. To make it clear I have:
1.0
1.1
1.2
2.0
2.1
2.2
now dragging the 1.0 below 2.2 means the whole “folder” of 1 will be switched with the whole folder of 2. I hope this is clear so far.

With the following code I would like to switch:


image
image

But the result is
2.0
2.0
2.1
2.1
2.2
2.2

I understand this is why the second update is including the items updated with the first step.
But I have no clue how to switch correctly.

Any idea for a simple approach?

Kind regards.