下载在对话框jsf2 primefaces中不起作用

时间:2012-08-12 13:45:04

标签: jsf-2 hyperlink download primefaces

我有这个问题 当我把下载链接放到一个对话框中它不起作用,但当我把它放入panelgrid时,它的工作原理 它是素面中的一个错误还是什么? 你有什么想法

1 个答案:

答案 0 :(得分:0)

<h:form>
        <p:panel header="Query">
            <.......some come is here ........
                        <p:commandButton value="Export CSV" icon="ui-icon-document"
                            process="@this" rendered="#{xxx.showTable}"
                            oncomplete="exportConfirmationDialogShow.show()"></p:commandButton>
                    </h:panelGrid>
                </p:outputPanel>
            </h:panelGrid>              
        </p:panel>

    </h:form>

对话;

<p:dialog header="Choose Delimiter Type" id="dialogCSV"
        widgetVar="exportConfirmationDialogShow" resizable="false">
        <h:form id="csvForm">
            <h:panelGrid columns="2" style="margin-bottom:10px">
                <h:outputLabel value="Delimiter:" />
                <p:selectOneRadio id="delimiter" value="#{xxx.delimiterType}">
                    <f:selectItem itemLabel="Tab" itemValue="tab" />
                    <f:selectItem itemLabel="Pipe" itemValue="|"  />
                    <f:selectItem itemLabel="Comma" itemValue="," />                        
                </p:selectOneRadio>
            </h:panelGrid>

            <p:commandButton id="exportCsv" value="Export CSV"
                actionListener="#{xxx.export2CSV}" ajax="false"
                onclick="PrimeFaces.monitorDownload(hideStatus)">
                <p:fileDownload value="#{xxx.exportFile}"
                    contentDisposition="attachment" />
            </p:commandButton>

        </h:form>
        <script type="text/javascript">
            function showStatus() {
                exportConfirmationDialogShow.show();
            }

            function hideStatus() {
                exportConfirmationDialogShow.hide();
            }
        </script>
    </p:dialog>