Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery Sortable connectWith calls the update method twice

In the code below the update function gets called twice when an item is moved from list sortable1 to sortable2. Though I need to call that function only once:

$("#sortable1 tbody, #sortable2 tbody").sortable({     connectWith: '.connectedSortable tbody',     helper: fixHelper,     handle : '.handle',     update : function () {         var order = $('#sortable1 tbody').sortable('serialize');     }     }).disableSelection(); 
like image 293
Abhishek Jain Avatar asked Aug 16 '10 11:08

Abhishek Jain


1 Answers

Answer from: http://forum.jquery.com/topic/sortables-update-callback-and-connectwith

update: function(e,ui) {     if (this === ui.item.parent()[0]) {         //your code here     } } 
like image 82
Stefan Avatar answered Oct 06 '22 13:10

Stefan