Last active
December 13, 2015 18:49
-
-
Save desireesantos/4958164 to your computer and use it in GitHub Desktop.
Gerar relatório com JSF 2.0 + primefaces: DataExporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p:dataTable id="questionario" var="perg" | |
value="#{perguntas.listarCadastrarPerguntas}" paginator="true" rows="10" | |
emptyMessage="Nenhuma pergunta cadastrada."> | |
<p:column exportable="false"> | |
<f:facet name="output"> | |
<h:outputText value="Pergunta" /> | |
</f:facet> | |
<h:outputText value="#{perg.value}" /> | |
</p:column> | |
<p:column style="display: none"> | |
<f:facet name="output"> | |
<h:outputText value="Pergunta1" /> | |
</f:facet> | |
<h:outputText value="#{perg.resposta1}" /> | |
</p:column> | |
<p:column> | |
<f:facet name="output"> | |
<h:outputText value="Resposta2" /> | |
</f:facet> | |
<h:outputText value="#{perg.resposta2}" /> | |
</p:column> | |
<p:column> | |
<f:facet name="output"> | |
<h:outputText value="Resposta3" /> | |
</f:facet> | |
<h:outputText value="#{perg.resposta3}" /> | |
</p:column> | |
<p:column headerText="4" style="width:auto"> | |
<f:facet name="output"> | |
<h:outputText value="Resposta4" /> | |
</f:facet> | |
<h:outputText value="#{perg.resposta4}" /> | |
</p:column> | |
<p:column> | |
<f:facet name="output"> | |
<h:outputText value="Resposta Correta" /> | |
</f:facet> | |
<h:outputText value="#{perg.respostaCorreta}" /> | |
</p:column> | |
</p:dataTable> | |
<!-- Button para gerar PDF - XLS - XML - CSV --> | |
<br /> <br /> | |
<h:panelGrid columns="2"> | |
<p:panel header="Exportar Relatório"> | |
<h:commandLink > | |
<p:graphicImage value="/img/excel.png" /> | |
<p:dataExporter type="xls" target="questionario" fileName="sipa" /> | |
</h:commandLink> | |
<h:commandLink ajax="false"> | |
<p:graphicImage value="/img/pdf.png" /> | |
<p:dataExporter type="pdf" target="questionario " fileName="sipa" postProcessor="#{perguntas.cadastrarPergunta}"/> | |
</h:commandLink> | |
<h:commandLink> | |
<p:graphicImage value="/img/csv.png" /> | |
<p:dataExporter type="csv" target="questionario" fileName="sipa" /> | |
</h:commandLink> | |
</p:panel> | |
</h:panelGrid> | |
<!-- Fim Button para gerar PDF - XLS - XML - CSV --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment