Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery ui sortable drop event

I am working with jquery ui sortable. I would like to get the sorting array to pass it to the handling file on drop event.

one funny thing i found.. http://jsfiddle.net/7Ny9h/

$(function() {     $( "#sortable" ).sortable();     $( "#sortable" ).disableSelection();      $( "#sortable li" ).droppable({         drop: function( ) {             var order = $("#sortable").sortable("serialize", {key:'order[]'});             $( "p" ).html( order );         }     }); }); 

Seeing the sample, if I move BOX No.2, the BOX 2 is left out of the array.

Perhaps I need a kind of "dropend" event because it seems that jquery ui drop event doesn't count the dragged and dropped one.

like image 647
user1942626 Avatar asked Jul 21 '13 10:07

user1942626


1 Answers

You can also use update to detect it.

$( "#sortable" ).sortable({     update: function( ) {         // do stuff     } }); 
like image 155
Ari Avatar answered Sep 18 '22 01:09

Ari