开发者

Updating Grails VIEW on domain contents change

开发者 https://www.devze.com 2023-04-06 08:20 出处:网络
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

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 al开发者_开发知识库ert. My system requires something similar.


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/

0

精彩评论

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

关注公众号