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

时间:2020-12-27 20:11:48

I want to update datatable from managedBean

我想从managedBean更新数据表

this datatable is inside p:tab inside p:tabView inside h:form inside p:dialog

这个数据表位于p:tab里面p:tabView里面h:form里面p: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

先谢谢你

1 个解决方案

#1


0  

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.

只要确保你没有将表单嵌套分开,让他们自己完成工作。

#1


0  

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.

只要确保你没有将表单嵌套分开,让他们自己完成工作。