Samet Dağ
Samet Dağ

Reputation: 113

Data Exporter for PrimeFaces Extensions Sheet

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

Upvotes: 2

Views: 274

Answers (1)

Jasper de Vries
Jasper de Vries

Reputation: 20158

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.

Upvotes: 1

Related Questions