<p:outputPanel autoUpdate="false" id="previewDataPanel" rendered="#{customReportController.previewData}">
<p:dataTable id="tbl" value="#{customReportController.data}" var="it"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink} {Exporters}"
paginator="true" rows="49" paginatorPosition="top">
<f:facet name="{Exporters}">
<p:commandButton id="print" value="Print All Data" icon="ui-icon-print">
<p:ajax event="click" update="tbl" />
<p:printer target="tbl" />
</p:commandButton>
<h:commandLink>
<p:commandButton id="pdf" value="Pdf" icon="ui-icon-print"></p:commandButton>
<p:dataExporter type="pdf" target="tbl" fileName="report" />
</h:commandLink>
<p:spacer></p:spacer>
<p:spacer></p:spacer>
<h:commandLink>
<p:commandButton id="csv" value="Csv" icon="ui-icon-print"></p:commandButton>
<p:dataExporter type="csv" target="tbl" fileName="report" />
</h:commandLink>
<p:spacer></p:spacer>
<p:spacer></p:spacer>
<h:commandLink>
<p:commandButton id="xls" value="Excel" icon="ui-icon-print"></p:commandButton>
<p:dataExporter type="xls" target="tbl" fileName="report" />
</h:commandLink>
</f:facet>
<p:columns value="#{customReportController.columnNames}" var="data" columnIndexVar="i">
<f:facet name="header">
<h:outputText value="#{data}" />
</f:facet>
<h:outputText value="#{it[i]}" />
</p:columns>
</p:dataTable>
这是我的代码。我想打印来自Datatable的所有数据。其他出口商工作正常,但当我尝试打印时,它只打印当前页面。