Currently I´m struggling with downloading a file after a method finishes.
<p:commandButton id="someID"
icon="ui-icon-folder-collapsed"
actionListener="#{bean.myMethod}"
ajax="true" value="test">
</p:commandButton>
myMethod does some fancy long Process stuff and takes some time. My Need is to offer a download after myMethod finshes. My Method calls a download a method to do some. Similar to the method here download function SO
As Long as I Processing: myMethod I show a "working indicator"
<p:ajaxStatus onstart="PF('dia').show()"
oncomplete="PF('dia').hide()" />
<p:dialog widgetVar="dia" modal="true" draggable="false"
closable="false" resizable="false" showHeader="false">
<h:outputText value="sometext" />
<p:graphicImage value="./img/ajax-loader.gif"></p:graphicImage></p:dialog>
I learned that I can't start a download from Ajax call (which the command Button from Primefaces starts per default). When changing the attribute ajax to false, myMehtod processes and show the download dialog after. Problem is during this I have no "working indicator" shown.
Primeface has this solution: primeface download Now my Question is it possible to start a method from the Button (and show the "working indicator") and when the method finishes still show the download dialog via fileDownload ?