2013-05-27 28 views
0

我有三個排序列表。這些列表可分類寬度the jhonny sortable plugin。排序後(onDrop),我只需要排序數據一個列表,而不是所有列表。約翰尼可排序插件:如何序列化只有一個列表

<ol class="sortable"> 
    <li data-id="1">Item I</li> 
    <li data-id="2">Item II</li> 
    <li data-id="3">Item III</li> 
</ol> 
<ol class="sortable"> 
    <li data-id="37">Item A</li> 
    <li data-id="12">Item B</li> 
    <li data-id="19">Item C</li> 
</ol> 
<ol class="sortable"> 
    <li data-id="21">Item One</li> 
    <li data-id="22">Item Two</li> 
    <li data-id="20">Item Three</li> 
</ol> 

的JavaScript:

var sort = $("sortable").sortable({ 
    onDrop: function (item, container, _super) { 

    var order = sort.sortable("serialize").get(); 

    // order contains the values of ALL lists 
    // shuld only contain the values of the ONE list! 

    } 
}); 

回答

0

嘗試

var order = item.parent().sortable("serialize").get(); 
+0

啊......完美,非常感謝你! –