Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails - dynamically adding to sortable_element

Am adding to a sortable list using Ajax, and to get the Scriptaculous effects to kick in after the add, the only way I have found is by re-executing sortable_element.

Can anyone suggest a better way of doing this, at the complete code is a hack:

><%= link_to_remote "Add",  
    :url => { :controller => "pages", :action => "add_fragment", :pid => pid, :index => index  },  
    :complete => "eval(decodeURIComponent(#{sortable_element 'frag_list', :url => sort_frag_pages_path, :complete => visual_effect(:highlight, 'frag_list'), :handle => 'handle'}).gsub('//',''));" %>
like image 531
tiny_clanger Avatar asked Feb 03 '26 09:02

tiny_clanger


1 Answers

the answer is to add this into the controller method called by the link_to_remote

page.sortable :frag_list

like image 92
tiny_clanger Avatar answered Feb 05 '26 00:02

tiny_clanger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!