views:

30

answers:

1

Hi - I am creating an application using ROR and would like to know how I can implement a function which I want to call when using "sortable.create".

Below is a sample code from my "*.html.erb" file.

<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>

Instead of "Alert" I want to call a actual function to which I can pass the parameters in this case the list "table_retain" and implement the function in 'Application Controller".

I would like to know the syntax as to how this can be done. I am new to ROR and any help will be greatly appreciated.

Thanks

A: 

Not sure if i'm missing something, but have you tried:

<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>
seengee