Drag n drop - save the reorder of rows

Drag n drop - save the reorder of rows

I'm working on a simple project and so far I'm not using any databases, but instead stores anything I need to save in the local storage. This time around I need to store the reorder of rows when using drag n drop. 

If I set an ID on each row, would it be possible to loop through the IDs to find the current position:
4,
2,
1,
3.

Then store the order in the local storage, then display them again in that order when opening the project/website the next time?