提问人:Betjamin Richards 提问时间:9/11/2013 最后编辑:OmiBetjamin Richards 更新时间:9/1/2017 访问量:536
best_in_place “:nil”函数在插入部分的 AJAX 中不起作用
best_in_place ":nil" function does not work in AJAX inserted partial
问:
我的页面上有一个记录列表。我通过 AJAX 远程提交表单,并将新记录附加到列表中。除 :nil 选项外,所有best_in_place功能都立即起作用。这不会显示我设置的默认值。这使得除非用户刷新页面,否则无法编辑该值。然后,该值存在,用户可以单击。
这是一个已知的错误吗?任何人都可以提出解决方法吗?
用我的代码更新:
<%= best_in_place_if can?(:update, post), post, :post_type, :path => account_post_path(account,post), :type => :select, :collection => Post::POST_TYPES.zip(Post::POST_TYPES), html_attrs: { "class" => "span2" }, :nil => "Click to assign" %>
这是在一个名为 _post.html.erb 的部分中,该部分通过 create.js.erb 文件插入:
$("#js_posts").prepend("<%= escape_javascript render 'post', :post => @post, :account => @account %>");
$("#js_add_post_button").button('toggle');
$("#js_add_post").collapse('hide');
$("#js_add_post").html("<%= escape_javascript render 'add_post', :new_post => Post.new, :account => @account %>");
答: 暂无答案
评论