2013-01-09 35 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

相关问题