I am using the JQuery.Sortable() function to create a reorderable list of items like so
<script type="text/javascript">
// When the document is ready set up our sortable with it's inherant function(s)
$(document).ready(function() {
$("#goal-list").sortable({
handle: '.handle',
placeholder: 'ui-state-highlight',
update: function() {
var order = $('#goal-list').sortable('serialize');
$("#info").load("/goals/process?" + order);
}
});
});
</script>
The result that comes back is a comma delimited list of the item ID's (i.e. 1,2,3,4,5,6 and so on)
What I want to know what is the best way to commit this to the related item table's sortorder column... I could loop through and update each record but I am thinking that is an awful lot of database writes and could pose a potential bottle neck especially if the list is rather large.
I'm using LINQ-to-SQL and ASP.NET MVC