2013-01-09 32 views
1

我明白如何獲得訂單,但我不知道如何在必要時將元素放回到之前的位置。可排序如何將元素放回到之前的位置?

請指教,非常感謝。

el.sortable({ 
    start: function(){ var order = etc //Got current order here// }, 

    update: function(){ 
     //Process and etc// 

     if(cancel) { 
      //how can I put the element back to the position before?? 
     } 

    }, 


}); 

回答

1

$( 「.selector」).sortable( 「取消」)就可以了(在你初始化你的排序,當然,內部沒有初始化)

el.sortable({ 
    start: function(){ var order = etc //Got current order here// }, 

    update: function(){ 
     //Process and etc// 

     if(cancel) { //NO NOT HERE 
      //how can I put the element back to the position before?? 
     } 

    }, 


}); 

el.sortable("cancel"); //here 

http://api.jqueryui.com/sortable/#method-cancel

取消()

取消在當前排序和重新改變在當前排序開始之前將其轉換爲狀態 。有用的停止和 接收回調函數。此方法不接受任何參數。

+0

非常感謝你,這是它! – Till

+0

el.sortable(「cancel」);甚至在裏面工作 – Till

相關問題