JSF 2.2 Command-Button关闭对话框

时间:2014-06-06 16:37:13

标签: jquery file-upload jsf-2 primefaces commandbutton

我正在使用Primeface 5.0,Glassfish 4.在此对话框中,我显示了一个文档列表,该列表可以附加到数据集中。文件上载正在运行,并且上传按钮的操作例程被触发以存储上载的文件。但是在命令按钮的动作例程完成后,数据列表会刷新并关闭对话框,但它不应该。 "删除"按钮工作正常并刷新datalist。

DlgVArEntryEdit.xhtml:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.org/ui"
  xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition>
    <p:dialog id="VArEntryViewDlg" 
              widgetVar="VArEntryViewDialog" 
              resizable="false"
              showEffect="fade" 
              hideEffect="explode"
              modal="true"
              header="Buchung">
        <h:form id="VArEntryViewDlgFrm" enctype="multipart/form-data">
            <p:panelGrid  rendered="#{arEntryController.selected != null}">

                <p:row>
                    <p:column><p:outputLabel value="Buchungs-ID:"/></p:column>
                    <p:column><p:outputLabel value="#{arEntryController.selected.arEntryId}" /></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="Buchnungs-No:"/></p:column>
                    <p:column><p:outputLabel value="#{arEntryController.selected.entryNo}" /></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="Storniert :"/></p:column>
                    <p:column><p:selectBooleanCheckbox value="#{arEntryController.selected.isCancelled}" /></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="Buchnugsreferenz"/></p:column>
                    <p:column><p:outputLabel value="#{arEntryController.selected.receiptNo} / #{arEntryController.selected.receiptType}"/></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="#{bundle.entryCode}"/></p:column>
                    <p:column><p:outputLabel value="#{arEntryController.selected.entryCodeName}"/></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="Datum"/></p:column>
                    <p:column><p:calendar value="#{arEntryController.selected.entryDate}" size="10" pattern="dd.MM.yyyy" showOn="button"/></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="#{bundle.entryText}"/></p:column>
                    <p:column><p:inputText value="#{arEntryController.selected.entryData}" size="100"/></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="#{bundle.Comment}"/></p:column>
                    <p:column><p:inputTextarea rows="5" cols="100" value="#{arEntryController.selected.entryComment}"/></p:column>
                </p:row>
                <p:row>
                    <p:column colspan="2">
                        <h:panelGroup id="uploadDataListId">
                            <p:dataTable id="UploadDatalist" 
                                         value="#{arEntryController.documents}" 
                                         var="item"
                                         selection="#{arEntryController.documentSelected}"
                                         rowKey="#{item.documentId}"
                                         style="width: 400px"
                                         >
                                <p:column headerText="#" style="width: 5%; text-align: center">
                                    <p:outputLabel value="#{item.documentId}"/>
                                </p:column>
                                <p:column headerText="#{bundle.DocumentName}" style="text-align: left">
                                    <p:outputLabel value="#{item.documentName}"/>
                                </p:column>
                                <p:column style="width:7%;text-align: center">
                                    <p:commandButton update=":VArEntryViewDlgFrm:UploadDatalist" 
                                                     action="#{arEntryController.removeDocument}" 
                                                     icon="ui-icon-trash" 
                                                     title="Löschen" 
                                                     process="@this">
                                        <f:setPropertyActionListener value="#{item}" target="#{arEntryController.documentSelected}" />
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>
                            <p:fileUpload id="fileUploadId" value="#{arEntryController.file}" mode="simple" />
                            <p:commandButton update=":VArEntryViewDlgFrm:uploadDataListId" 
                                             process=":VArEntryViewDlgFrm:fileUploadId"
                                             actionListener="#{arEntryController.upload}"
                                             ajax="false"
                                             value="Upload"/>
                        </h:panelGroup>
                    </p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="geladene #{bundle.DocumentCount}"/></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="Netto"/></p:column>
                    <p:column><p:inputText value="#{arEntryController.selected.amountNet}">
                                <f:convertNumber currencySymbol="€" groupingUsed="true"
                                         maxFractionDigits="2" type="currency" />
                            </p:inputText></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="USt-Code"/></p:column>
                    <p:column><p:inputText value="#{arEntryController.selected.GSTName}"/></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="USt"/></p:column>
                    <p:column><p:inputText value="#{arEntryController.selected.amountGst}">
                                    <f:convertNumber currencySymbol="€" groupingUsed="true"
                                         maxFractionDigits="2" type="currency" />
                                </p:inputText></p:column>
                </p:row>
                <p:row>
                    <p:column><p:outputLabel value="Brutto"/></p:column>
                    <p:column><p:inputText value="#{arEntryController.selected.amountTotal}">
                                <f:convertNumber currencySymbol="€" groupingUsed="true"
                                         maxFractionDigits="2" type="currency" />
                            </p:inputText></p:column>
                </p:row>
            </p:panelGrid>
            <p:commandButton value="#{bundle.Cancel}" 
                             style="float:right;" 
                             process="@this" 
                             actionListener="#{arEntryController.closeDlg}" 
                             update=":formCenter :growl"
                             onclick="PF('VArEntryViewDialog').hide()"/>
            <p:commandButton value="#{bundle.Delete}" 
                             style="float:right;" 
                             process="@this" 
                             actionListener="#{arEntryController.remove}" 
                             update=":formCenter :growl"
                             oncomplete="PF('VArEntryViewDialog').hide()"/>
            <p:commandButton value="#{bundle.Change}" 
                             style="float:right;" 
                             actionListener="#{arEntryController.updateEntry}" 
                             update=":formCenter :growl"
                             oncomplete="PF('VArEntryViewDialog').hide()"/>
        </h:form>
    </p:dialog>
    </ui:composition>
</html>

我不知道为什么上传按钮关闭对话框而删除按钮却没有。这有什么不对?

0 个答案:

没有答案