单击commandButton后更新对话框中的outputText

时间:2019-02-04 16:00:50

标签: primefaces modal-dialog xhtml

请考虑以下.xhtml

    

<ui:composition template="/layout/layout.xhtml">
    <ui:define name="body">
        <h:form id="kokosMockForm">
            <p:growl id="msgs" showDetail="true"/>
            <p:dialog id="myDialog" header="My Header" widgetVar="dlg" modal="true" width="700" height="400">
                <h:outputText value="#{myController.myField}"/>
            </p:dialog>

            <p:commandButton value="My Button" type="button" onclick="PF('dlg').show()"/>
        </h:form>
    </ui:define>
</ui:composition>
</html>

我希望每当字段myController.myField更改时,outputText都会更新。我已经在Google上搜索了很多,并尝试了很多类似的事情:

  • p:commandButton value =“我的按钮” ajax =“ false” type =“ button” onclick =“ PF('dlg')。show()”
  • p:commandButton value =“我的按钮” type =“ button” update =“ myDialog” oncomplete =“#{p:widgetVar('dlg')}。show()”

0 个答案:

没有答案
相关问题