I have a dinamically primefaces dataTable, with 2 columns and some rows. The table by default, always start empty, and the data is loaded with a commandButton. The problem is that the pdf file and the excel file always is returned empty.
The glassfish or the console doesnt show any error.
<h:form id="inputForm" enctype="multipart/form-data">
<p:panel id="panel" style="">
<p:panel header="Export Page Data">
<h:commandLink>
<p:graphicImage value="/resources/imagenes/excel.png" />
<p:dataExporter type="xls" target="censoTabla" fileName="Censos" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/resources/imagenes/pdf.png" />
<p:dataExporter type="pdf" target="censoTabla" fileName="Censos" pageOnly="true"/>
</h:commandLink>
</p:panel>
<p:selectOneMenu value="#{healthViewBean.aniosValue}" effect="fade" >
<f:selectItem itemLabel="Select" itemValue="#{healthViewBean.yearsValue}" />
<f:selectItems value="#{healthViewBean.list}" var="task" itemLabel="#{task.label}" itemValue="#{task.value}" />
</p:selectOneMenu>
<br />
<p:commandButton update="panel,tabla" value="Load data" actionListener ="#{healthBean.loadData()}" />
</p:panel>
<p:panel id="tabla">
<p:dataTable id="censoTabla" var="health" value="#{healthViewBean.centros}">
<p:column headerText="health status">
<h:outputText value="#{health.centroSalud}" />
</p:column>
<p:column headerText="No.">
<h:outputText value="#{health.numMedicos}" />
</p:column>
</p:dataTable>
</p:panel>
</h:form>