开发者

Rails - dynamically adding to sortable_element

开发者 https://www.devze.com 2022-12-29 20:47 出处:网络
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.

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 开发者_Go百科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('//',''));" %>


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

page.sortable :frag_list

0

精彩评论

暂无评论...
验证码 换一张
取 消