繁体   English   中英

为什么命令按钮关闭我的对话框

[英]Why the command button close my dialog box

我在 primefaces 6.0 上工作,我有一个由命令按钮调用的对话框,我在此对话框中有几个元素和 2 个命令按钮,一个用于关闭对话框,另一个(commandButton id="enableDisableButton")是我的程序的一个选项。 它必须显示 True 或 False,例如 select boolean 按钮。 但是当我点击按钮时,它关闭了我的对话框,我不明白为什么!

<p:dialog header="Modal Dialog" widgetVar="rulesDialogBox" modal="true" 
                    width="540" height="400" minWidth="540" minHeight="400"
                    dynamic="true">

    <p:panelGrid columns="1" style="border:none !important;">
        <h:outputText id="selectedFile" value="#{eventConfigurationView.loadedFile}"/>

        <p:fileUpload label="#{msgs.rule_browse}" fileUploadListener="#{eventConfigurationView.handleFileUpload}" mode="advanced" 
                      update="selectedFile" auto="true" sizeLimit="100000" allowTypes="/(\.|\/)(xls)$/"
                      minHeight="30px" minWidth="110px"
                      style="margin-bottom:20px;" />
                      <!-- allowTypes="/(\.|\/)(xls|csv|xlsx)$/" -->

        <p:commandButton value="#{msgs.download}" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);" style="margin:5px;" 
                            minHeight="30px" minWidth="110px">
            <p:fileDownload value="#{eventConfigurationView.file}" />
        </p:commandButton>

        <p:commandButton id="enableDisableButton" 
                            value="#{eventConfigurationView.myEnable}" style="margin:5px;" 
                            action="#{eventConfigurationView.buttonAction}"
                            ajax="false"
                            minHeight="30px" minWidth="110px">
        </p:commandButton>

        <p:commandButton value="#{msgs.close}" onclick="PF('rulesDialogBox').hide();" type="button" style="margin:5px;" 
                            minHeight="30px" minWidth="110px"/>
    </p:panelGrid>
</p:dialog>
    public void buttonAction() {
        System.out.println("buttonAction");
   }

假设您引用p:commandButton id="enableDisableButton"您已通过ajax="false"在其上禁用 ajax 。 这会在单击时重新加载整个页面。 由于p:dialog的初始 state 被隐藏,看起来对话框消失了,而实际上页面已经完全重新加载。

暂无
暂无

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

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