Problems with Dataexporter

Asked

Viewed 347 times

0

I cannot export data from my table, even following the example of Primefaces Showcase. I use version 5.0.

inserir a descrição da imagem aqui

        <h:commandLink>
            <p:graphicImage library="img" name="xlsx.png" width="32" title="Exportar para Excel"/>
            <p:dataExporter type="xlsx" target="dataTable" fileName="Relatorio" />
        </h:commandLink>

        <h:commandLink>
            <p:graphicImage library="img" name="pdf.png" width="37" title="Exportar para PDF"/>
            <p:dataExporter type="pdf" target="dataTable" fileName="Relatorio"/>
        </h:commandLink>

        <p:dataTable var="r" value="#{controleBean.reservatorios}"
            paginator="true" rows="30" id="dataTable"
            emptyMessage="Nenhum Reservatorio Cadastrado"
            paginatorPosition="bottom" 
            selection="#{controleBean.reservatorioSelecao}"
            selectionMode="single" rowKey="#{r.idReservatorio}"> 

            <p:ajax event="rowSelect"
                update=":form:btnEditar :form:btnExcluir" />
            <p:ajax event="rowUnselect"
                update=":form:btnEditar :form:btnExcluir" />

            <p:column headerText="Nome">
                <h:outputText value="#{r.nomeReservatorio}" />
            </p:column>

            <p:column headerText="Capacidade (Lt)">
                <h:outputText value="#{r.capacidadeReservatorio}" />
            </p:column>

            <p:column headerText="Tipo">
                <h:outputText value="#{r.tipoReservatorio}" />
            </p:column>

            <p:column headerText="Observação">
                <h:outputText value="#{r.obsReservatorio}" />
            </p:column>
        </p:dataTable>
  • I also had problems trying to use the Xporter from a datatable, outside the table. I didn’t want to waste time and I didn’t check the cause thoroughly. I suggest using according to the showcase of the first faces, using the <f:facet name="{Exporters}"> within the dataTable.

  • @Rodrigo, I will be later. If this has solved my problem I warn you here. Thank you.

1 answer

-2

<p:dataExporter type="pdf" target="dataTable" fileName="Relatorio"/>

change the value in your target, to an id;

<datatable id=tblUm.....>.......</datatable>

<p:dataExporter type="pdf" target="tblUm" fileName="Relatorio"/>

Browser other questions tagged

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