只要在PrimeFaces </p:dialog>中打开新对话框,就更新<p:dialog>

时间:2014-08-06 13:23:12

标签: primefaces

它会一直显示以前的值而不是新值。

<p:panel id="instantTransPanel" header="Quick Transfer (To Beneficiary)" toggleable="true" closable="false" toggleSpeed="500" closeSpeed="500" widgetVar="instantTransPanelVar"
rendered="#{userMBean.loggedOnUser.customer.customerType != constantuserMBean.getFETSTYPE() and (userMBean.loggedOnUser.customer.customerType != constantuserMBean.getMERCHANTTYPE() or (userMBean.loggedOnUser.customer.customerType == constantuserMBean.getMERCHANTTYPE() and userMBean.loggedOnUser.customer.hasCustomerCapability))}">
                <p:commandButton value="Add New Beneficiary" onclick="addBendlg.show();" />
                <br/><br/>
                <p:dataTable id="beneficiariesTable" var="obj" value="#{userMBean.loggedOnUser.customer.customerBeneficiaryList}"
                    paginator="true" rows="20"
                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                    rowsPerPageTemplate="20,50,100" style="width:100%" resizableColumns="true">

                    <p:column sortBy="#{obj.beneficiaryMsisdn}" headerText="Mobile Number" filterBy="#{obj.beneficiaryMsisdn}" filterMatchMode="contains">
                        <h:outputText value="#{obj.beneficiaryMsisdn}" />
                    </p:column>
                    <p:column sortBy="#{obj.beneficiaryName}" headerText="Name" filterBy="#{obj.beneficiaryName}" filterMatchMode="contains">
                        <h:outputText value="#{obj.beneficiaryName}" />
                    </p:column>
                    <p:column sortBy="#{obj.crt_dt}" headerText="Date Added">
                        <h:outputText value="#{obj.crt_dt}" />
                    </p:column>
                    <p:column headerText="Transfer">
                        <p:commandButton value="Transfer" update=":form:transferBenPanel" action="#{engineMBean.initTransfer(obj.beneficiaryMsisdn, obj.beneficiaryName)}" oncomplete="transferToBendlg.show();" />
                    </p:column>
                    <p:column headerText="Delete">
                        <p:commandButton ajax="false" onclick="return confirm('Are you sure?');" action="#{userMBean.deleteBeneficiary(obj.beneficiaryMsisdn)}" icon="ui-icon-close" style="margin:0"/>
                    </p:column>
                </p:dataTable>
            </p:panel>

之后它会调用对话框并且第一次正常工作,但是下次我想要输入另一个值时,会弹出旧值。

<p:dialog id="addBenDialog" header="Add Beneficiary" widgetVar="addBendlg" modal="true" dynamic="true" position="center">
        <p:panelGrid columns="2" cellpadding="5" style="margin-bottom:10px;">
        <f:facet name="header"></f:facet>

        <h:outputLabel for="bmsisdn" value="Beneficiary Mobile Number: *" />
        <p:inputText id="bmsisdn" value="#{userMBean.beneficiary.beneficiaryMsisdn}">
            <p:ajax update="bname" />
        </p:inputText>

        <h:outputLabel for="bname" value="Beneficiary Name: " />
        <h:outputText id="bname" value="#{userMBean.lookUpBeneficiaryName(userMBean.beneficiary.beneficiaryMsisdn)}" />

        <f:facet name="footer">
            <p:commandButton ajax="false" onclick="return confirm('Are you sure?');" action="#{userMBean.addBeneficiary}" value="Save" icon="ui-icon-disk" style="margin:0"/>
        </f:facet>

        </p:panelGrid>
    </p:dialog>

1 个答案:

答案 0 :(得分:0)

您需要在显示之前更新对话框。

将代码更改为:

<p:commandButton value="Add New Beneficiary" onComplete="addBendlg.show(); update=:form:addBenDialog" />