Doubts in the use of the dataExporter

Asked

Viewed 906 times

1

Guys, I’m using the primeFaces support to pdf the contents of a datatable. The problem is that the pdf does not bear the name of the columns, only the content. In the examples I saw in the showcase, it captures the column name and table title if any.

Here’s how I’m using the tag:

<p:dataExporter type="pdf" target="idDatabela" fileName="relatorio" pageOnly="true"   />
  • You could provide as the options of the datatable are idDatabela?

1 answer

1


I’m going to leave a table that I created here and it worked, creating the columns, each with its name. The only divergent thing is that I created an xls file, 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>
  • I was screwing up anyway @Gustavo, I put the column name in the component p:column, when the component that is captured by p:dataExporter is f:Facet like this in your example. Thanks for the help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.