【问题标题】:download doesn't work inside dialog jsf2 primefaces下载在对话框 jsf2 primefaces 中不起作用
【发布时间】:2012-08-12 13:45:04
【问题描述】:

我有这个问题 当我将下载链接放入对话框时它不起作用,但是当我将它放入 panelgrid 时它起作用 它是primefaces中的错误还是什么? 你有什么想法吗

【问题讨论】:

  • 对话框中有嵌套表单的可能性吗?
  • 我不明白你的意思
  • 我只是明白为什么对我不起作用,当我将下载链接放在对话框中时它可以工作,但是如果它在 ui:repeat 里面它就不起作用:我只是测试一下:你呢有任何想法让这个组件在 ui:repeat 中工作,谢谢
  • 我也测试了 h-datatable ,很遗憾,它不起作用,你遇到过这个问题吗?
  • 重复convert Bytes[] to StreamedContent fro download jsf2.0 primefaces3.3.1 请不要一遍又一遍地转发同样的问题。而是编辑和改进您在同一问题上的原始问题。

标签: jsf-2 hyperlink download primefaces


【解决方案1】:
<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>

【讨论】:

  • 如果您在回答中包含此代码如何工作的简要说明,特别是它如何回答原始问题,我们更喜欢 SO。这有助于使这些答案成为其他人的更好资源。
猜你喜欢
  • 2013-09-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-19
  • 2014-12-24
  • 2013-07-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多