0

我试图从我的数据表中导出数据,但是当我按下 pdf 按钮时,它会刷新页面而不导出

   <h:commandLink  >
        <p:graphicImage value="/images/excel.png" />
        <p:dataExporter type="xls" target="dataTable" fileName="alarms" />
    </h:commandLink>

    <h:commandLink  >
        <p:graphicImage value="/images/pdf.png" />
        <p:dataExporter type="pdf" target="dataTable"  fileName="alarms"/>
    </h:commandLink>

      <h:commandLink  >
        <p:graphicImage value="/images/csv.png" />
        <p:dataExporter type="csv" target="dataTable" fileName="alarms" />
    </h:commandLink>
4

2 回答 2

0

<p:commandLink>必须被<h:form>标签包围才能工作。如果这不是问题,您能否提供整个页面的源代码和您正在使用的 PrimeFaces 版本?

于 2014-05-17T08:49:06.050 回答
0
<h:commandLink style=" text-align: right!important;"
    immediate="true" id="excelLinkId" ajax="false" >
        <p:dataExporter type="xls" target="myTable" fileName="myExcel" />
</h:commandLink>
于 2018-09-10T10:46:16.957 回答