O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exporting data in various formats

The dataExporter component allows exporting the content of the table into various formats such as XLS/XLSX, PDF, CSV, and XML. It also supports exporting the current data on a page and also only the selected data on the table by providing the ability to exclude particular columns and manipulating the exported data with pre and post processors.

How to do it...

A basic definition for having data-exporting ability with a command link that encapsulates a PDF icon would be as follows:

<h:commandLink>
<p:graphicImage value="/resources/images/export/pdf.png" />
<p:dataExporter type="pdf" target="countriesTable" fileName="countries" />
</h:commandLink>

How it works...

In the previous definition, target defines the server-side ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required