Rails、元素显示和页面更新
我有一系列 div
,每个 div 都有一个删除链接。每一个还有一个当前隐藏的旋转图像。想法是,当按下删除链接时(并且 div
中的对象被删除),将显示微调器。一旦完成删除对象的 AJAX 调用,div
项目就会从系列中删除。
我的问题基本上是显示旋转图像。
这是我正在使用的代码:
def destroy_object(object)
update_page do |page|
page.show "spinner-del-#{object.id}"
end
remote_function(
:url => url_for(object),
:method => :delete
)
end
remote_function 部分调用一个 rjs,它会正确删除相关的 div
,所以这不是问题。但是,显示微调器的 update_page
部分不起作用,我真的不明白为什么。
有什么想法吗?谢谢!
I have a series of div
s, and each one has a delete link. Each one also has a currently hidden spinner image. Idea is that when the delete link is pressed (and the object in the div
is being deleted), the spinner is displayed. Once the AJAX call to delete the object is done, then the div
item is removed from the series.
My problem here is basically getting the spinner image to display.
This is the code I am using:
def destroy_object(object)
update_page do |page|
page.show "spinner-del-#{object.id}"
end
remote_function(
:url => url_for(object),
:method => :delete
)
end
The remote_function portion calls an rjs which removes the relevant div
properly, so that's not an issue. However, the update_page
section to show the spinner isn't working, and I really can't figure out why.
Any ideas? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我更改了代码以使用
:before
选项,该选项是remote_function
调用的一部分,并且它有效。耶!
I changed the code to use the
:before
option that is part of theremote_function
call, and it worked.Yay!