Yes you have to store it into your DB or use a variable stored in local storage.
If you’re using a DB to store your items, you can add a column “order” to store the position, and update the position of every item using a workflow action on item changed (the trigger give you the updated list)
If you’re using local storage you can update the variable containing your items with the same workflow and let weweb store it in local storage so it will be restored after a reload
Both array index or db column style works. But the first one will require you some logic to build the array and restore it.
My apology for digging into an old thread, but I also want to know how to do this.
I have made the extra “order” column in the database (Supabase) to store the position, but I can’t figure out how to create the workflow. I found the ‘On item moved’ trigger and see the ‘updatedList’ trigger on the On item moved variable.
But don’t know how to combine everything to make the re-order possible. I hope you can assist me with the appropriate direction or solution.
Hi, in your workflow you can iterate on the list with a loop and update the order column of every item in your DB through an update supabase action
The list correspond to the new ordered items, so you can use the index of the loop and put it inside your order column. Tell me if it doesn’t make sense to you I will try to explain it better!
For the ID I guess you have to bind Event.item.id ?
For the order, your last screenshot, you’re binding the new index of the new item, what I think you should bind is the index of the loop. You will find somewhere in the explorer the loop variable with the index inside.
So, at each iteration of updatedList, you will send the index of the loop as the new order of the element.
If you want it to start at 1, you will have to do loop->index + 1 in the formula, because an index start at 0.
You bound “Event.item.id” as Record ID for the “update a record” action.
But it should be the id from the record you have inside Action.loop. You are updating multiple time the same record, so it end up having always the order of the last item in your kanban (3)
About the on item removed, I see the action is set on the stack element. But, how do I trigger it exactly? I added a button in a card and a workflow on click, but it’s not linked to the on item removed workflow…