What's the best way to manage list item sort order with Drag & Drop UI?

Posted by Reddy S R on Programmers See other posts from Programmers or by Reddy S R
Published on 2012-06-21T04:03:01Z Indexed on 2012/06/21 9:23 UTC
Read the original article Hit count: 295

Filed under:
|
|

I have a list of Students that I should display to user on a web page in tabular format.
The items are stored in DB along with SortOrder information.

On the web page, user can rearrange the list order by dragging and dropping the items to their desired sort order, similar to this post.

Below is a screenshot of my test page.
enter image description here

In the above example, each row has sort order info attached to it. When I drop John Doe (Student Id 10) above the Student Id 1 row, the list order should now be: 2, 10, 1, 8, 11.

What's the optimistic (less resource hungry) way to store and update Sort Order information?

My only idea for now is, for every change in the list's sort order, every object's SortOrder value should be updated, which in my opinion is very resource hungry.

Just FYI: I might have at most 25 rows in my table.

© Programmers or respective owner

Related posts about c#

Related posts about sorting