0

I have a VF pages that takes on parameters, and when a "Search" button is clicked, a call is made to an external source. The returned results are displayed on an output panel that rerenderes after the results become available. My "Search" button has a rerender tag as part displaying a spinner, but it loads the OutputPanel before it had the chance to return any data, hence why my results never get populated on the outputPanel. I can see the reuslts in my debug logs. Is there a way to rerender an outputannel after the data is available?

Controller:

public with sharing class DonorSearchCon {

  public DonorSearchCon() {
    showAdvSearchResults = false;
  }

  public void doAdvSearch(){
   //api call logic and data merging...
   showAdvSearchResults = true;
  }
}

VF Page:

<apex:form id="crForm">

  <li class="slds-button-group-item">
    <apex:commandButton styleclass="slds-button slds-button--neutral slds-grow" value="Search" action="{!doAdvSearch}" status="recordSearchid" rerender="crForm" /> 
     <apex:actionStatus id="recordSearchid">
        <apex:facet name="start">
           <div class="demo-only demo--inverse" style="height:6rem">
             <div role="status" class="slds-spinner slds-spinner_medium">
                <span class="slds-assistive-text">Loading</span>
                  <div class="slds-spinner__dot-a"></div>
                    <div class="slds-spinner__dot-b"></div>
             </div>
           </div>
        </apex:facet>
     </apex:actionStatus>
  </li

<apex:outputPanel id="cdireturn"> <!-- This panel is rendered before the {!doAdvSearch} finish excecuting hence why {!showAdvSearchResults} does not switch to "True"-->
  <apex:outputPanel rendered="{!showAdvSearchResults}" > 

<!--Result Logic--->

  </apex:outputPanel>
</apex:outputPanel>

</apex:form>
  • Without rerendering the form, can you rerender the cdireturn ? i.e. in the button code rerender="cdireturn" – highfive Oct 22 '19 at 15:27
  • Thank you for the feedback. That is how I attempted to do it initially, but the panel would still not rerender. Also if i try to render just that one panel, then no other panel get rerendered, or error messages that validate the input fields on the VF page. That is why I try to rerender the whole Form. – Ivo Dimov Oct 22 '19 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.