38
Views
4
Comments
Solved
[Drag and Drop] How to get items list order?
Question
Drag and Drop
Forge asset by OutSystems Labs
Application Type
Mobile

I have list of divs that are draggable. How can I get orders of this element? For exmle on button click?

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

Hello.

The DragAndDrop component has a Change event, but that only gives you the old and new index. If you keep track on page of all the changes the block returns, you can know all the list. Best if you need the position of everything at all times.

The other option is to use JavaScript and track the data-id attribute inside the list. This one may be trickier to implement, but will work fine.

2025-09-25 14-38-22
Lokesh Kumar Yadav

Bind your list  to the DragAndDrop component. It auto-updates the order. On button click, just use LocalList—it already has the new order.  Try with this  

2023-03-13 10-26-05
Sriyamini

Hi @Lukasz Kapron,

You can refer this below forum discussion. Hope it helps.

https://www.outsystems.com/forums/discussion/50005/drag-n-drop-list-iteration-and-refresh/

Thanks,

Sriyamini J


2016-04-22 00-29-45
Nuno Reis
 
MVP

That link is about Traditional, the question is about ODC.

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

Hello.

The DragAndDrop component has a Change event, but that only gives you the old and new index. If you keep track on page of all the changes the block returns, you can know all the list. Best if you need the position of everything at all times.

The other option is to use JavaScript and track the data-id attribute inside the list. This one may be trickier to implement, but will work fine.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.