Multiple <a4j:status> within a <a4j:region>
scottstevenson Dec 2, 2008 5:03 AMMyFaces 1.1.5
RichFaces 3.1.6
I have a page which uses an <a4j:repeat> to render a dynamic number of "portlets" (they are not real portlets, only some static HTML pulled from other applications) when the page is loaded. It is not possible to use a <a4j:region> within <a4j:repeat> (see http://www.jboss.org/jbossajax4jsf/docs/devguide/en/html/BasicConceptsOfTheAjax4jsfFramework.html#SomeProblemsWithRendering ) so everything must go inside the same region.
I have a requirement to show a loading indicator for each section however, as I only have one region I only get one indicator.
Any idea how I would go about creating an indicator for each area that I am loading? My code is below. Thanks in advance.
<f:verbatim>
 <script type="text/javascript" />
 var rowCount = 0;
 var loadPortalJS = "";
 </script>
</f:verbatim>
<a4j:log />
<t:htmlTag value="BR" />
<a4j:region>
 <a4j:repeat value="#{portalBean.portalList}" var="portal" rowKeyVar="row"
 ajaxKeys="#{portalBean.rowKeys}">
 <a4j:portlet>
 <a4j:jsFunction name="loadPortal#{row}" action="#{portalBean.actionLoadPortal}"
 reRender="portalData">
 <a4j:actionparam name="row" value="#{row}" />
 </a4j:jsFunction>
 <jsfsdc:section value="#{portal.title}">
 <jsfsdc:column>
 <a4j:status>
 <f:facet name="start">
 <jsfsdc:outputText value="Loading..." />
 </f:facet>
 <f:facet name="stop">
 <jsfsdc:outputText value=" " escape="false" />
 </f:facet>
 </a4j:status>
 </jsfsdc:column>
 <jsfsdc:column>
 <t:panelGroup id="portalData">
 <t:outputText value="#{portal.portalData}" escape="false" />
 </t:panelGroup>
 </jsfsdc:column>
 <jsfsdc:column>
 <t:div />
 </jsfsdc:column>
 <jsfsdc:column>
 <jsfsdc:selectOne value="#{portal.dropDownValue}" defaultValue="false">
 <f:selectItem itemLabel="5" itemValue="5" />
 <f:selectItem itemLabel="15" itemValue="15" />
 <f:selectItem itemLabel="25" itemValue="25" />
 <a4j:support event="onchange" action="#{portalBean.actionLoadPortal}" reRender="portalData" >
 <a4j:actionparam name="row" value="#{row}" />
 </a4j:support>
 </jsfsdc:selectOne>
 </jsfsdc:column>
 <jsfsdc:column>
 <t:div />
 </jsfsdc:column>
 <jsfsdc:column>
 <a4j:commandButton value="Refresh" action="#{portalBean.actionLoadPortal}"
 reRender="portalData">
 <a4j:actionparam name="row" value="#{row}" />
 </a4j:commandButton>
 </jsfsdc:column>
 </jsfsdc:section>
 <t:htmlTag value="BR" />
 <t:htmlTag value="BR" />
 <f:verbatim>
 <script type="text/javascript" />
 loadPortalJS = loadPortalJS+'loadPortal' + rowCount++ +'();';
 </script>
 </f:verbatim>
 </a4j:portlet>
 </a4j:repeat>
</a4j:region>
<rich:jQuery selector="document" timing="onload" query="each(function () {eval(loadPortalJS);});"/>