Step 1: Make the UL LI list:

<ul id="sortme">
 <li id="27" class="sortitem">蒼龍</li>
 <li id="44" class="sortitem">朱雀</li>
 <li id="136" class="sortitem">玄武</li>
 <li id="19" class="sortitem">白虎</li>
</ul>

Step 2: Make the List Sortable

$(document).ready(function() {
	  $("#sortme").sortable({});
});

Step 3: Capture Mouse Up Event

$("#sortme").bind("mouseup", function(){
	alert('Mouseup Event');
});

Step 4: Get the Serial Data

$("ul li").each(function(i){
	data[i] = $(this).text() ;
});

But problem for this one is you get one more item: total member in data array is R+1

IN Step 4: Can also use the built in function:

strdata = $(this).sortable("serialize");

But here the ID of the UL list must be in form of xxx_1, xxx_2… etc. And also PROBLEM is in the mouseup event handler, the strdata only captures R-1 data !!! WHY WHY WHY

Post a Comment

*
*