PrimeFaces Extensions Sheet 数据导出器

huangapple go评论54阅读模式
英文:

Data Exporter for PrimeFaces Extensions Sheet

问题

如何在PrimeFaces Extensions Sheet中导出数据,类似于PrimeFaces DataTable?

我尝试过PrimeFaces DataTable导出器,但它不支持表格。

<p:commandButton value="XLS" styleClass="mr-2 mb-2">
    <p:dataExporter type="xls" target="mainForm:sheet" fileName="department"/>
</p:commandButton>

它抛出org.primefaces.extensions.component.sheet.Sheet无法转换为org.primefaces.component.datatable.DataTable异常。我如何为PrimeFaces Extensions Sheet使用数据导出器。

JSF:2.2.1,PrimeFaces:12.0.0,PrimeFaces Extensions:12.0.5

英文:

How can i export data in PrimeFaces Extensions Sheet like PrimeFaces DataTable?
I tried PrimeFaces DataTable exporter like below but it doesn't support sheet table.

<p:commandButton value="XLS" styleClass="mr-2 mb-2">
    <p:dataExporter type="xls" target="mainForm:sheet" fileName="department"/>
</p:commandButton>

It throws org.primefaces.extensions.component.sheet.Sheet cannot be cast to org.primefaces.component.datatable.DataTable exception. How can I use data exporter for PrimeFaces Extensions Sheet.

JSF: 2.2.1, PrimeFaces: 12.0.0, PrimeFaces Extensions: 12.0.5

答案1

得分: 1

以下是翻译好的部分:

根据异常显示以及文档中所述,p:dataExporter 必须指向一个 PrimeFaces DataTable

由于Sheet没有扩展 DataTable,因此它不会与 p:dataExporter 一起工作。

使其工作的选项包括:

  1. 重构 Sheet 以扩展 DataTable。我没有调查过这一点,也不知道是否可能。
  2. 为表格创建一个导出器。

您可以创建一个问题报告,以请求对表格的导出支持。如果您能提供一个拉取请求,那将更好。

英文:

As the exception shows, and what the documentation states, p:dataExporter "must point to a PrimeFaces DataTable".

As Sheet does not extend DataTable, p:dataExporter will not work with it.

Options to get it working are:

  1. Refactor Sheet to extend DataTable. I did not investigate this, and do not know if this is possible at all.
  2. Create an exporter for sheets.

You could create an issue to request export support for sheets. It would be even better if you would provided a pull request with it.

huangapple
  • 本文由 发表于 2023年4月17日 15:20:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76032572.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定