开发者

jQuery UI sortable - Saving changes to server

开发者 https://www.devze.com 2023-01-07 14:12 出处:网络
I am using this and it\'s working perfectly on the browser http://docs.jquery.com/UI/Sortable Now I want to save it to the server, I know about serialize, but I don\'t want to update everything.

I am using this and it's working perfectly on the browser

http://docs.jquery.com/UI/Sortable

Now I want to save it to the server, I know about serialize, but I don't want to update everything.

On the server I only want to know what was mo开发者_开发知识库ved to where.

Is it possible to find that out on the stop event? And how?

Thanks in advance.


One solution would be to set your stop function to this:

stop: function(e,ui) {
    var allItems = $(this).sortable("toArray");
    var newSortValue = allItems.indexOf( $(ui.item).attr("id") );
    alert($(ui.item).attr("id") + " was moved to index " + newSortValue);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消