阿贾克斯更新不能正常工作,数据表上使用过滤器时(JSF,Primefaces) [英] Ajax update doesn't work, when using filter on datatable (JSF, Primefaces)

查看:152
本文介绍了阿贾克斯更新不能正常工作,数据表上使用过滤器时(JSF,Primefaces)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个确定时代,其中包括primefaces的过滤功能。一些操作可以在表(例如,编辑)来完成。之后的使用者的操作使用AJAX是完成了确定时代将被更新。 这直接更新表,效果很好,如果我不过滤的数据表,可惜没有如果我使用它,并对其进行编辑。

这就是我的数据表是这样的:

 <电话号码:dataTable中的id =dataTable的VAR =行
                值=#{bean.value}
                filteredValue =#{bean.filteredValue}
                分页程序=真正的行=25paginatorPosition =底
                rowKey =$ {row.id}
                paginatorTemplate ={CurrentPageReport} {Firs​​tPageLink} {previousPageLink} {PageLinks} {NextPageLink} {} LastPageLink
                编辑=真正的>
 

和它触发更新的按钮

 <电话号码:的commandButton值=保存
                        的ActionListener =#{bean.save}
                        更新=:形式/>
 

解决方案

更​​新后的数据表你必须调用它的客户端过滤器()方法。

 <电话号码:dataTable的widgetVar =dataTableWidgetVarID =dataTable的VAR =行
             值=#{bean.value}
             filteredValue =#{bean.filteredValue}
             分页程序=真正的行=25paginatorPosition =底
             rowKey =$ {row.id}
             编辑=真正的>

<电话号码:的commandButton值=保存
                 的ActionListener =#{bean.save}
                 更新=:表
                 的onComplete =dataTableWidgetVar.filter();/>
 

I have a datable which includes the filter feature of primefaces. Some operations can be done on the table (e.g. edit). The datable will be updated after the user's operation is completed using ajax. It updates the table directly and works well, if I don't filter the datatable, unfortunately not if I use it and edit it.

That's how my datatable looks like:

    <p:dataTable id="dataTable" var="row"
                value="#{bean.value}"
                filteredValue="#{bean.filteredValue}"
                paginator="true" rows="25" paginatorPosition="bottom"
                rowKey="${row.id}"
                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                editable="true">

and the Button which triggers the update

<p:commandButton value="Save"
                        actionListener="#{bean.save}"
                        update=":form"/>

解决方案

After updating datatable you have to invoke it's client side filter() method.

<p:dataTable widgetVar="dataTableWidgetVar" id="dataTable" var="row"
             value="#{bean.value}"
             filteredValue="#{bean.filteredValue}"
             paginator="true" rows="25" paginatorPosition="bottom"
             rowKey="${row.id}"
             editable="true">

<p:commandButton value="Save"
                 actionListener="#{bean.save}"
                 update=":form"
                 oncomplete="dataTableWidgetVar.filter();"/>

这篇关于阿贾克斯更新不能正常工作,数据表上使用过滤器时(JSF,Primefaces)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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