in my project. And i need some functionality. in my project. And i need some functionality. in my project. And i need some functionality.

Override dataExporter method or realize lazy export in jsf

1.6k Views Asked by At

I use <p:dataExporter type="xls" target="reportTable" fileName="ExportResult"/> in my project. And i need some functionality.

<p:panelGrid columns="1" styleClass="currentReportTablesStyle" style="text-align: center">
    <p:commandButton value="Load Data"
                     id="dataLoaderButton"
                     ajax="false"
                     action="#{QCforCCReportBean.LoadReport()}"/>
    <h:outputText value="Export to format:"/>
    <h:commandLink disabled="#{QCforCCReportBean.isNotAdministrator}">
        <p:graphicImage name="/images/xls_file.png" width="24"/>
        <p:dataExporter type="xls" target="reportTable" fileName="ExportResult"/>
    </h:commandLink>
</p:panelGrid>

When i click to commandButton - "Load Data" for export data, triggered method from "#{QCforCCReportBean.LoadReport()}". This method have two variable in parameters: first and pageSize. I set This variables 0 and 50. It work cool. I have lazy and good pagination. For example 0-50, 50-100, 100 - 150 etc. But when i tried export data, triggered some method "#{QCforCCReportBean.LoadReport()}" but variables is 0- 87587(or another big number. all rows from table) and my java crash with java.lang.OutOfMemoryError: GC overhead limit exceeded

I want override method for export data or modify dataExporter save data by parts

1

There are 1 best solutions below

5
Kukeltje On

The magnificant PrimeFaces 5.2 Documentation states on page 132 a list of attributes. One of them is:

pageOnly    0    String    Exports only current page instead of whole dataset

And on page #133 there even is an example:

PageOnly

By default dataExporter works on whole dataset, if you ’ d like export only the data displayed on current page, set pageOnly to true.

<p:dataExporter type="pdf" target="tableId" fileName="cars" pageOnly="true"/>