Doubts in using the dataExporter

1

I am using the dataExporter from primeFaces to export the contents of a dataTable into pdf. The problem is that the pdf does not bring the name of the columns, just the content. In the examples I've seen in the showcase, it captures the column names and table title if any.

Here's how I'm using the tag:

<p:dataExporter type="pdf" target="idDatabela" fileName="relatorio" pageOnly="true"   />
    
asked by anonymous 10.11.2014 / 20:39

1 answer

1

I'm going to leave a table I created here and it worked, creating the columns, each with its name. The only thing divergent is that I created an xls file, from excel.

<p:dataTable value="#{bean.lista}" var="variavel"
    id="dataTable"
    currentPageReportTemplate="Registro(s): {startRecord} a {endRecord} total de {totalRecords} - Página: {currentPage}/{totalPages}"
    paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
    emptyMessage="Não existem cadastros." paginator="true" rows="10">
    <p:column>
        <f:facet name="header">NOME DA COLUNA</f:facet>
        <h:outputText value="#{variavel.nome}" />
    </p:column>
</p:dataTable>

<h:commandLink>
    <p:graphicImage library="img" name="excel.png" width="24" />
    <p:dataExporter type="xls" target="dataTable" fileName="listaXLS"/>
</h:commandLink>
    
11.11.2014 / 17:11