2 Replies Latest reply on Aug 27, 2008 8:56 PM by sbasinge

    Automatically Update Page After Loading Complete

    sbasinge
      I have a Dashboard type page that gets data from several different external sources.  Some of the calls to get data may take a bit of time to complete.  What I'd like to do is show that dashboard page with the table headings, and display the spinner.gif while calls are made in the background to go get data.  I can do this manually by adding a4j:support with onchange event.  Is there a recommended way to go about this?

      <ui:define name="body">
        <script type="text/javascript">
          window.onload = function()
          {
             page1:myGuestSalesLoadData = "true";
          }
        </script>

      <rich:panel id="MyGuestSalesPanel" header="My Guest Sales">
        <h:inputText id="myGuestSalesLoadData">
          <a4j:support event="onchange"
            actionListener="#{PersonalSalesManager.setLoadMySalesData('true')}"                              
            reRender="personalSalesList" limitToList="true"  />
        </h:inputText>
        <a4j:status>
          <f:facet name="start">
            <h:graphicImage value="/img/spinner.gif" />
          </f:facet>
        </a4j:status>
                        
        <rich:dataTable  id="personalSalesList" var="_salesBean"
            value="#{PersonalSalesManager.personalSales}">
          <rich:column>
            <f:facet name="header">
              <h:outputText value="Sales Month" />
            </f:facet>
            <h:outputText value="#{_salesBean.salesDate}">
              <f:convertDateTime type="date" pattern="MMM yyyy"/>
            </h:outputText>
          </rich:column>
          <rich:column>
            <f:facet name="header">
              <h:outputText value="Month To Date" />
            </f:facet>
            <h:outputText value="#{_salesBean.periodSales}" />
          </rich:column>
      ...
        </rich:dataTable>
      </rich:panel>