Grails:关于数据更改的更新视图 [英] Grails: update view on data change

查看:54
本文介绍了Grails:关于数据更改的更新视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是更新一个数据已更改的.gsp页面.

What I would like to do is to update a .gsp page on data is change.

类似这样的事情: http://weichhold.com/2009/07/20/uppleating-multiple-page-fragments-with-grails-and-ajax/,但此处的内容页面不会因数据更改而更改.

Something like this: http://weichhold.com/2009/07/20/updating-multiple-page-fragments-with-grails-and-ajax/ but here the content page doesn't change on data changes.

有一种简单的方法吗?

推荐答案

在不完全刷新页面的情况下更新UI的通常方法是通过 Grails AJAX 调用.

The usually approach to updating the UI without a complete page refresh is through Grails AJAX calls.

但是,基于您提供的有限信息,我认为您需要实现某种轮询机制来定期调用服务器以确定是否有新数据要呈现.

However based on the limited information you have provided, I think you would need to implement some sort of polling mechanism to periodically call you server to determine if there is new data to render.

这是执行我建议的jQuery插件

这是一个 stackoverflow问题,其中编码了类似的解决方案直接在javascript中

Here is a stackoverflow question where a similar solution is coded directly in javascript

这篇关于Grails:关于数据更改的更新视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆