根据域内容更改更新 Grails VIEW
类似问题: Grails:更新数据更改视图
我想更新当数据库中与域相关的数据发生更改时,grails 会进行视图。我知道 AJAX 似乎是完成此类任务的最佳方式,但似乎需要我单击链接或输入一些文本。
最好的方法是轮询域对象以查看数据是否每 x 秒更改一次,或者这会导致问题吗?
也许我可以通过在控制器保存/更新操作中插入相应的代码来重新渲染部分视图?
最终结果应该类似于 Facebook 在屏幕左下角显示通知提醒的方式。当其他人更改与您相关的数据时,您会收到警报。我的系统需要类似的东西。
Similar Question: Grails: update view on data change
I would like to update a grails view when the data in the database relating to the domain is changed. I understand that AJAX seems to be the best way of doing such a task however it seems that requires I either click a link, or enter some text.
Would the best method be polling the domain object to see if the data has changed every x seconds, or can that lead to issues?
Perhaps if I can re-render a partial view by inserting the respective code in the controllers save/update actions?
The final result should be something similar to how Facebook have notification alerts at the bottom left of the screen. When somebody else changes data that is related to you, you receive an alert. My system requires something similar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在客户端中进行轮询,尽管这会影响扩展和性能。考虑某种服务器推送技术(http://en.m.wikipedia.org/wiki/Push_technology)。我正在考虑为此使用大气。
编辑:查看这篇文章 http://codeyeti。 com/posts/ajax-push-in-grails-using-the-atmosphere-plugin/
You could poll in the client, though that has scaling and performance implications. Consider some kind of server push technology (http://en.m.wikipedia.org/wiki/Push_technology). I'm considering using Atmosphere for this.
Edit: check out this article http://codeyeti.com/posts/ajax-push-in-grails-using-the-atmosphere-plugin/