Rails - dynamically adding to sortable_element

Posted by tiny_clanger on Stack Overflow See other posts from Stack Overflow or by tiny_clanger
Published on 2010-05-05T19:41:02Z Indexed on 2010/05/06 20:38 UTC
Read the original article Hit count: 127

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('//',''));" %>

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about AJAX