2010-09-17 20 views
0

我正在使用ROR創建一個應用程序,並想知道如何使用「可排序」來實現我想調用的函數。創建」。如何在Rails中使用sortable.create時實現在onUpdate方法中調用的函數

下面是我的「* .html.erb」文件中的示例代碼。

<script type="text/javascript"> 
    Sortable.create("table_retain", { 
     tag:"tr" , dropOnEmpty: true, onUpdate: function() { alert ('Updated!'); }, 
     containment:["table_aware","table_consider","table_acquire"], ghosting:true 
    }) 
</script> 

相反的「警報」我要調用一個實際的功能,我可以傳遞參數在這種情況下,列表中的「table_retain」和實施「應用程序控制器」的功能。

我會想知道語法如何可以做到這一點我是新來的回報率和任何幫助將不勝感激

感謝

回答

0

不知道如果我失去了一些東西,但你嘗試過:。

<script type="text/javascript"> 
    Sortable.create("table_retain", { 
     tag:"tr" , dropOnEmpty: true, onUpdate: function() { yourFunction("table_retain"); }, 
     containment:["table_aware","table_consider","table_acquire"], ghosting:true 
    }) 
</script> 
相關問題