I have an array of elements: markers and a table which updates it's rows to populate with the data stored within markers. markers itself houses an object marker which has a latitude and longitude amongst other things.
When I populate the table with the details from the markers array I give each row an ID based on i as it loops through.
On this table I have jQuery sortable. I am looking for a way to re-order my markers array each time the rows are sorted, so that the position of the item in the array is actually it's sort order value. That way, I can simply loop through the array at any time and see it's most up to date order.
So far I have the table generating as should and the markers array populated. I am even able to grab back the order of the rows after shuffling them around, at the moment I store them in an array orders and just alert, this works (ie. 0,1,2 > dragged to resort > 2,0,1). I was hoping for a way of now using the set of values in orders to resort my original markers array.
I thought it would involve creating a temporary array markersTemp with which to store the values saved in markers but in the new order, except I'm not sure how to loop through to save each one. Anyone done anything similar?