Hi all,
I'm using a drag & drop component Sortable Drag and Drop ODC (ODC)
to reorder a list of approvers. The dragging works fine on the frontend, but I need help connecting it to my local variable.
Have a local list variable Approvers
Drag & drop works visually, but the Approvers list doesn't update
What I need:When user drags items, I need the local Approvers list to reflect the new order so when I save, it has the correct sequence.
Has anyone done this integration before? How do I capture the new order from SortableJS and update my OutSystems local variable?
Using ODC, Traditional Web.
Thanks!
Hi @Wei Sheng Pang .
The component block exposes an OnChange event, which gives you Index.From and Index.To. One important detail: these indexes are not zero-based they start at 1.
To update your local list (Approvers) according to the new order, you can do the following inside the event handler:
With this logic, your local list will always stay in sync with the drag-and-drop order shown on the screen.