How to save order # after dragging Kanban card to a different stack?

I have lessons that are in different categories in a Kanban board (structure is kinda like Weweb academy where a program has a couple of categories and each category has lessons):

Kanban board is binded to “selectedLessonsofProgram”:

It is basically an array of lessons with some extra detail of the category it is in:

Each lesson has a lessonNumber(Across all categories, what’s the order?) and Order Number (Within the category, what’s the order?)

The Kanban is stacked by categories, “SelectedCategoriesofProgram” as I want it to be in ascending category order too:

When I try to move a card from one stack to another in this Kanban, the “EventUpdatedList” doesn’t give me the entire array of lessons, but only the lessons in the new column.

You can see here, selectedLessonsofProgram has 7 objects in the array (7 lessons), but in the next step when I try to update this variable with the new “Eventupdatedlist”, it only has 4 objects not 7.

But I need the whole event updated list of 7 items in order to update the LessonNumber and OrderNumber…

How do I get the right event updated list to show?

Bump! Is there something wrong with the eventUpdatedList function of the Kanban or am I doing something wrong? :face_with_monocle:

Hi, it’s a design choice, the kanban event contain only the list where the item was added or moved.

Do you really need to update the others column items index ? Even if it create a void between index 0 and 2 for exemple it will still be ordered correctly, and if you move something inside this column the correct index will be applied and it will no longer have a “void”

If its important for you, you can instead put a workflow on the stack, you will have a workflow on add, on remove, and on move.

So when you move item 2 from category 2 to category 3

  • it will trigger on add on cat 3, with the new list of cat 3
  • It will trigger on remove on cat 2, with the new list of cat 2

And so you will be able to update the index of every items impacted by the change

Sorry, I’m trying to understand… So if I have 2 columns in this order:

Column A has (Julia, Alex, Caleb)

Column B has (Mary, Jane, Bob)

and I move Alex to between Jane and Bob,

Caleb will now be #2 and not #3 in column A. So how do I update the order # of Caleb from #3 to #2?

And then Bob is now #4 and not #3 in Column B.

I know I need to use the iterator loop thing but how do I update the new order # of both columns on item moved?

  1. My first question was, do your really need Caleb to be updated ? Does it break something if there is no item at position #2 as long as they are properly ordered ?

  2. If yes you have two options :

A. On the event we give you the from and the to columns, so you can just add another iteration in your workflow and go through your filtered items by column from and refresh the order property for every items.

B. Add another workflow at the stack level.

The on removed event will be fired on the column A as you removed Alex, and the event will contain the updated list of the column A.

Inside the workflow you would have to do something similare to what you did in the on moved event of the kanban, to update your items.