Changing the order of items in an array without database interaction

I have an array that is displayed using a repeat and would like to change the order of the items.

I’ve added a button [+] and to each array item. Pressing these should either increase or decrease the position of the item in the array (hence swap with preceding or following item).

I am aware of the various dragging suggestions elsewhere on the forum, but looking for something very basic without interaction with a database, is that possible?

Hello,
Where does the data come from? Are you using the array component?

Apologies, not an expert, hope this envisioned process clarifies?

  1. Column 1: List items from DB using serverconnect and repeat1
  2. User clicks items
  3. Selected items are added to array
  4. Column 2: Selected items are listed using repeat2 based on array with [+] / buttons
  5. User can click [+] / buttons to increase/decrease position in array

Unfortunately you cannot change the order of the items in an array component like that.

Thanks @Teodor. So the only way would be to “reload” the array?

I did this last week… I wrote a server side thingie (can’t remember what the name is for them now!) which just swaps the values of a numeric field called position_number.

Can paste you a screen shot when next at the computer!

Thanks @Antony, would be nice to see how you did it.

In the meantime I found another way using “replaceAt”, “$index” and “slice” (to get preceding and following $value):

ps. if I paste code in this message only half of it is visible, that’s why I’ve uploaded an image