Time for action – using DataExporter to export data into XLS and PDF formats
Let us see how we can use various features of DataExporter, such as exporting a whole dataset, exporting the only current page, and excluding some columns:
- Create a DataTable and a DataExporter component to export all the data, only page data, and register pre- and post-processors for XLS and PDF exporters:
<p:dataTable id="usersTbl" var="user" value="#{adminController.users}" rowKey="#{user.id}" paginator="true" rows="10"> <p:column headerText="Id"> <f:facet name="header"> <h:outputText value="Id" /> </f:facet> <h:outputText value="#{user.id}" /> </p:column> <p:column> <f:facet name="header"> <h:outputText value="Email" /> </f:facet> <h:outputText value="...