I'm trying to put a data table with in a column a link to download a pdf file aditional in the footer a download data explorer, the problem is if i put a action in the commandlink with ajax=false the pdf works but the dataexplorer do the same download the jasper pdf. If put ajax="true" works the dataexplorer but the pdf do nothing what im doing wrong?
Code: Select all
<p:dataTable id="tbl" var="op" value="#{ordenDePagoBean.ordenes}"
paginatorAlwaysVisible="false" paginator="true" rows="10">
<p:column headerText="#{msg.label_fecha}">
<h:outputText value="#{op.fechaOrdenDePago}" />
</p:column>
<p:column headerText="#{msg.label_numero}" >
<h:outputText value="#{op.numeroOrdenDePago}" />
</p:column>
<p:column headerText="#{msg.label_empresa}" >
<h:outputText value="#{op.empresa}" />
</p:column>
<p:column headerText="#{msg.label_monto}" >
<h:outputText value="#{op.monto}" />
</p:column>
<p:column headerText="" >
<p:commandLink actionListener="#{ordenDePagoBean.download(op)}" update="messages">
<p:graphicImage value="/images/pdf.png" />
</p:commandLink>
</p:column>
</p:dataTable>
<h:panelGrid columns="2">
<p:panel header="Exportar todos">
<h:commandLink>
<p:graphicImage value="/images/excel.png" />
<p:dataExporter type="xls" target="tbl" fileName="ordenes" />
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/images/pdf.png" />
<p:dataExporter type="pdf" target="tbl" fileName="ordenes"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/images/csv.png" />
<p:dataExporter type="csv" target="tbl" fileName="ordenes" />
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/images/xml.png" />
<p:dataExporter type="xml" target="tbl" fileName="ordenes" />
</h:commandLink>
</p:panel>
<p:panel header="Exportar pagina actual">
<h:commandLink>
<p:graphicImage value="/images/excel.png" />
<p:dataExporter type="xls" target="tbl" fileName="ordenes" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/images/pdf.png" />
<p:dataExporter type="pdf" target="tbl" fileName="ordenes" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/images/csv.png" />
<p:dataExporter type="csv" target="tbl" fileName="ordenes" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="/images/xml.png" />
<p:dataExporter type="xml" target="tbl" fileName="ordenes" pageOnly="true"/>
</h:commandLink>
</p:panel>
</h:panelGrid>
Code: Select all
public void download(OrdenDePago op) throws DaoException {
if (op != null) {
ReporteOrdenDePagoService.downloadPdf(op.getCuit(), op.getNumeroOrdenDePago());
}
}