简体   繁体   English

如何从托管bean jsf2 primefaces更新数据表

[英]how to update datatable from managed bean jsf2 primefaces

I want to update datatable from managedBean 我想从managedBean更新数据表

this datatable is inside p:tab inside p:tabView inside h:form inside p:dialog 此数据表位于p:tabp:tabViewh:formp:dialog

I tested this : but it is not updated : 我测试了这个:但是没有更新:

RequestContext.getCurrentInstance().update("tabView:lesarticles");

here is the dialog : 这是对话框:

<p:dialog id="dialogc" modal="true" header="Nouveau Article"
    widgetVar="dlgc">

and here is the form(inside dialog ) : 这是表格(在对话里面):

<h:form prependId="false" id="formdialogc">

the tabView and datatable : tabView和datatable:

<p:tabView id="tabView" style="font-size: 14px;">

            <!-- ajouter elements -->
            <p:tab id="info_produit" title="Produits">



<p:dataTable id="lesarticles"  var="car" widgetVar="carsTable"
                    rowKey="#{car.ligneCommandeFournisseurId}"
                    value="#{commandeMB.commande.ligneCommandeFournisseurs}">

is there any way to resolve this problem 有什么办法可以解决这个问题

thank you in advance 先感谢您

Well that should be simple: 好吧,这应该很简单:

<p:commandLink action="#{bean.getList}" update=":dataTableForm"/>

In the getList method I am assuming your refreshing the list which is shown in the p:dataTable : 在getList方法中,我假设您正在刷新p:dataTable显示的列表:

<h:form id="dataTableForm">
    <p:dataTable/>
</h:form>

Just make sure that you are not nesting the forms seperate them and let them to do their own jobs. 只需确保您不嵌套表格即可将它们分开,并让它们完成自己的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM