Drag - Drop Reorder Your Repeating Group

Hey @laurence :slight_smile: I’ve had trouble with this before too, especially making sure Tasks stay in the correct positions as you mentioned. To be honest, I’m really not sure if this is the most efficient way to set this up, but happy to share this incase it’s helpful! Here is an example:

Preview:

Editor:

In this example, I first created four Tasks and set a number for their Order field (this will change the more they are dragged/dropped):

On the page, the repeating group sorts the Tasks by the Order field from least to greatest:

Within each repeating group cell, there is a Droparea (which turns blue when it is dragged over) and a Droppable Group containing the Name of the Task and its Order field value (just to get an idea of how these change). When a Droppable Group is Dragged/Dropped the actions are:

Action 1: Make Changes to a Task (The Task which was just dropped’s Order is being changed to the Order of the Task it was just dropped on):

Action 2: Make Changes to a List of Tasks (this is adjusting the Tasks below the Task which was just dropped). Here all of the below Tasks’ Order fields have 1 added to them, to ensure they stay below the Task that was just dropped. The constraints in the list filter make sure that we’re not adjusting the Task which was just dropped again, and we’re only changing Tasks that have an order field greater than or equal to (below) the just dropped Task’s Order:

Action 3: Make Changes to a List of Tasks (the Tasks above the Task which was just dropped). Here all of the above Tasks’ Order fields have 1 subtracted from them, to ensure they stay above the Task that was just dropped. The constraints in the list filter make sure that we’re not adjusting the Task which was just dropped again, and we’re only changing Tasks that have an order field less than or equal to (above) the just dropped Task’s Order:

For very large lists this may not be a practical solution for capacity reasons, but it is the only way I’ve found to keep everything in place at all times. If you have any questions, feel free to let me know! :slight_smile:

12 Likes