[英]PrimeFaces DataExporter to XLS for multiple tables
Am trying to Export XLS format from multiple tables. 我正在尝试从多个表中导出XLS格式。 I have browsed and used some code, But its not working.
我已经浏览并使用了一些代码,但是无法正常工作。 Using primefaces extensions code is there but complete code is not there it seems in this link.
在此链接中似乎有使用primefaces扩展代码,但没有完整的代码。 I need solution for this.
我需要解决方案。
Code i have used : Tbl1, Tbl2, Tbl3 are table widgetVar's. 我使用的代码:Tbl1,Tbl2,Tbl3是表widgetVar的表。
<p:commandLink id="xls" ajax="false" >
<p:graphicImage value="/images/excel.png" />
<pe:exporter type="xlsx" target="Tbl1, Tbl2, Tbl3" fileName="tables"/>
</p:commandLink>
You should not address them by widgetVar. 你不应该widgetVar解决这些问题。 From the PrimeFaces Extensions Exporter (emphasis mine):
从PrimeFaces Extensions导出器(重点是我的):
Here we can export multiple tables by providing multiple datatable server ids with the delimiter as "comma"(or ",").
在这里,我们可以通过提供多个数据表服务器ID(使用分隔符作为“逗号”(或“,”))来导出多个表。
I work with primefaces 6.2 and this works for me (I'm not sure about other versions) without use primefaces extension 我使用的是primefaces 6.2,这对我有效(我不确定其他版本),而无需使用primefaces扩展
<p:dataTable id="tbl1" value="#{ManagedBean.listValues}" var="vt">
<p:column headerText="LabelPrint">
<h:outputText value="#{vt.id}"/>
</p:column>
</p:dataTable>
<p:dataTable id="tbl2" value="#{ManagedBean.otherList}" var="vt2">
<p:column headerText="Name Field Print">
<h:outputText value="#{vt2.name}"/>
</p:column>
</p:dataTable>
<h:commandLink>
<p:graphicImage url="#{resource['/images/icons/table-xls.png']}"/>
<p:dataExporter type="xls" target="tbl1, tbl2" fileName="My Data" pageOnly="true" />
</h:commandLink>
You separate your "id" of tables for export with (,) in attribute target of p:dataexporter object. 您在p:dataexporter对象的属性目标中用(,)分隔要导出的表的“ id”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.