在下面的代码中,当某个项目从列表 sortable1
移动到 sortable2
时,更新函数会被调用两次。虽然我只需要调用该函数一次:
$("#sortable1 tbody, #sortable2 tbody").sortable({
connectWith: '.connectedSortable tbody',
helper: fixHelper,
handle : '.handle',
update : function () {
var order = $('#sortable1 tbody').sortable('serialize');
}
}).disableSelection();
最佳答案
回复:http://forum.jquery.com/topic/sortables-update-callback-and-connectwith
update: function(e,ui) {
if (this === ui.item.parent()[0]) {
//your code here
}
}
关于jquery Sortable connectWith 调用 update 方法两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3492828/