根据域内容更改更新 Grails VIEW

发布于 2024-12-05 02:23:35 字数 376 浏览 1 评论 0原文

类似问题: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞美少年 2024-12-12 02:23:35

您可以在客户端中进行轮询,尽管这会影响扩展和性能。考虑某种服务器推送技术(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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文