Reputation: 1
I'm having a problem with the PrimeFaces component p:dataExporter. Here is my code:
<p:commandButton value="Export to Excel" ajax="false">
<p:dataExporter type="xls" target=":mainForm:mainTable" fileName="export" />
</p:commandButton>
When I click on the button it just refreshes the XHTML page and produces no XLS downloads. I have tried both h:commandButton and h:commandLink but it still doesn't work. Also, I have tried linking POI v3.10 and v3.7 but still the same error. I have no idea how to proceed. Please help.
Upvotes: 0
Views: 1561
Reputation: 146
I'll say my problem that I had with this, I hope this helps:
My problem was that, when the page was reloaded my dataTable was reloaded every time and when I change my data by filter o sort something, the values was newly reloaded and when the user filter by something the dataTable change, but when him click to export, the page newly charge and the values charge again, and the export doesn't had the correct values. I've changed the scope of my ManagedBean from: @ViewScoped to @SessionScoped, of that way when the page is reloaded the values of the query is permanent and when I filter by something and refresh the page, the same values are permanent therefore when i click to export, the correct values are exported.
Upvotes: 1