Primefaces数据表动态更新 [英] Primefaces datatable dynamic update

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

问题描述

我想更新的数据表中的列(特定列)动态地在服务器中的数据变化就必须通过Ajax调用反映UI。我怎样才能做到这一点与primeface。

解决方案

您可以使用通过的 号码:民意调查 标签

从Primefaces文档:

  

投票是具有发送定期AJAX能力的Ajax组件   在JSF支持bean的请求,并执行监听器

 < H:格式ID =形式>
    <电话号码:dataTable中的id =标签......>
      // COLS
    < / P:dataTable的>

    <电话号码:轮询间隔=3
            听众=#{counterBean.increment}更新=标签/>
< /小时:形式GT;
 

I want to update the datatable columns (particular columns) dynamically as the data changes in the server it has to reflect in UI through ajax call. How can I achieve this with primeface.

解决方案

you can use polling mechanism provided by primefaces using p:poll tag.

From Primefaces Documentation:

Poll is an ajax component that has the ability to send periodical ajax requests and execute listeners on JSF backing beans

<h:form id="form">  
    <p:dataTable id="tab" ...>
      //cols
    </p:dataTable>  

    <p:poll interval="3"   
            listener="#{counterBean.increment}" update="tab" />  
</h:form> 

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

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