You need to sign in to do that
Don't have an account?
Luis Guilherme Marques Lino
How to stop Visualforce "Status Spinner" after return of PageReference (CSV Export)
Hello!
I'm relatively new to Salesforce and I'm facing some difficulties to show the Visualforce Spinner during CSV Export.
Currently on my Visualforce I have the following code:
If the first verification fails I return null, if it's fine I generate the instance of my CSV Export page and returns it.
The main problem here is that whenever I return null, the spinner works fine stopping after the processing has ended.
But when I return the PageReference, even it just making an download of the csv file, it never stops and keeps spinning forever.
Can anyone help me to solve this issue?
To end with this development I must show to the user that "something is happening", while the download doesn't begin.
Thank you!
I'm relatively new to Salesforce and I'm facing some difficulties to show the Visualforce Spinner during CSV Export.
Currently on my Visualforce I have the following code:
<apex:commandButton disabled="{! lPermissaoExportar }" status="pageStatus" action="{! botaoExportar }" value="Exportar" reRender="mensagem, pageStatus"/> <apex:actionStatus id="pageStatus"> <apex:facet name="start"> <apex:outputPanel > <img src="/img/loading32.gif" width="25" height="25" /> <apex:outputLabel value="Carregando..."/> </apex:outputPanel> </apex:facet> </apex:actionStatus>And on my controller:
if (this.lInicio == null || this.lFim == null || this.lInicio > this.lFim) { Mensagem_erro__c mensagem = Mensagem_erro__c.getInstance(); String cMensagem = (mensagem.VF_importar_erro_data__c != null) ? mensagem.VF_importar_erro_data__c : 'Data não preenchida ou Data de inicio maior que a data fim!'; setMensagem(cMensagem); return null; } PageReference pg = new PageReference('/apex//RelatorioCaseCSV'); pg.getParameters().put('Inicio', EncodingUtil.urlEncode( String.valueOf(this.lInicio), 'UTF-8')); pg.getParameters().put('Fim', EncodingUtil.urlEncode( String.valueOf(this.lFim), 'UTF-8')); pg.getParameters().put('Status', EncodingUtil.urlEncode( this.lFltStatusCaso , 'UTF-8')); pg.getParameters().put('Tipo', EncodingUtil.urlEncode( this.lFltTipoCaso , 'UTF-8')); return pg;
If the first verification fails I return null, if it's fine I generate the instance of my CSV Export page and returns it.
The main problem here is that whenever I return null, the spinner works fine stopping after the processing has ended.
But when I return the PageReference, even it just making an download of the csv file, it never stops and keeps spinning forever.
Can anyone help me to solve this issue?
To end with this development I must show to the user that "something is happening", while the download doesn't begin.
Thank you!
On my class I created an variable with the PageReference that is setted when everything goes fine.
On Visualforce I'm using jquery for functionality.
I call the status during the processing method and I don't return the pageReference.
In onComplete method from the button I call the JavaScript that, if the variable "lAtualizar" is true, submit the outputLink on _parent with the value of the PageRegerence variable.
This is working fine for me, showing the processing status and returning the PageReference aswell.
All Answers
try below code : i hope it helps you.
kindly Let me inform if it helps you and close your query by choosing best answer if you got your right answer so it can helps others
thanks
sfdcmonkey.com
I tried with your code but the problem persists.
The button becomes the spinner and never comes back to button.
Look like the commandButton never receives the "onComplete" status back.
Thank you for your idea anyway!
On my class I created an variable with the PageReference that is setted when everything goes fine.
On Visualforce I'm using jquery for functionality.
I call the status during the processing method and I don't return the pageReference.
In onComplete method from the button I call the JavaScript that, if the variable "lAtualizar" is true, submit the outputLink on _parent with the value of the PageRegerence variable.
This is working fine for me, showing the processing status and returning the PageReference aswell.