0
I cannot export data from my table, even following the example of Primefaces Showcase. I use version 5.0.
<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 thedataTable
.– Rodrigo
@Rodrigo, I will be later. If this has solved my problem I warn you here. Thank you.
– HDeiro