views:

105

answers:

1

I want to render 6 blocks on a page asynchronously using richfaces a4j support. To accomplish this I have defined 6 a4j:region components and an a4j:commandLink for manual refreshing of the components.

Here is the relevant code:

<ui:define name="body">
    <h:form id="dashboardform">
     <div class="table_container" style="width:99%">
        <h:panelGrid id="dashboadPanel" columns="3">

            <a4j:region id="resourceGraphRegion">
                <h:panelGroup>
                    <div class="rounded_box dashboard_box">
                        <ui:include src="dashboard_resourceGraph.xhtml"/>
                    </div>
                </h:panelGroup>
            </a4j:region>

            <a4j:region id="profileGraphRegion">
                <h:panelGroup>
                    <div class="rounded_box dashboard_box" >
                         <ui:include src="dashboad_profileGraph.xhtml"/>
                    </div>
                </h:panelGroup>
            </a4j:region>

            <a4j:region id="reportGraphRegion">
                <h:panelGroup>
                    <div class="rounded_box dashboard_box" >
                        <ui:include src="dashboard_reportGraph.xhtml"/>
                    </div>
                </h:panelGroup>
            </a4j:region>

            <a4j:region id="installedBaseGraphRegion">
                <h:panelGroup>
                    <div class="rounded_box dashboard_box" >
                        <ui:include src="dashboard_installedBaseGraph.xhtml"/>
                    </div>
                </h:panelGroup>
            </a4j:region>

            <a4j:region id="simcardGraphRegion">
                <h:panelGroup>
                    <div class="rounded_box dashboard_box">
                        <ui:include src="dashboard_simcardGraph.xhtml"/>
                    </div>
                </h:panelGroup>
            </a4j:region>

            <a4j:region id="orderOverviewGraphRegion">
                <h:panelGroup>
                    <div class="rounded_box dashboard_box" id="order">
                        <ui:include src="dashboard_orderOverviewGraph.xhtml"/>
                    </div>
                </h:panelGroup>
            </a4j:region>
        </h:panelGrid>

            <h:panelGrid id="dashboadRefreshPanel" columns="1"  width="100%">
                <a4j:commandButton value="#{I18n.messages['dashboard.btn.refresh']}" 
                    action="#{dashboardBean.doRefresh}" reRender="resourceGraphRegion, profileGraphRegion, reportGraphRegion, installedBaseGraphRegion, simcardGraphRegion, orderOverviewGraphRegion"
                     image="/static/images/refresh.png" style="border:0px; margin-right: 20px; padding: 0px; float: right;" />
            </h:panelGrid>
    </div> 

However, when manually triggering the a4j:commandLink the whole page becomes inactive (grays out) and a loading icon appears. What I would like is the the page opens up very smoothly and that all 6 regions are rendered async so the user gets a smooth experience and doesn't have to wait for all regions to complete .

+1  A: 

To control the loading notification you can use

<a4j:status id="commonstatus"  startText="In progress..." stopText="Complete"/>

This allows you to ste the status field of almoust any "link" to use that status control.

tutorial

Cid54
Exactly what I needed, I tip my hat to you, good Sir!
nkr1pt