Tuesday 22 May 2012

Add AJAX “Loading..” control in XPages for Partial Updates

This is a two step process:

1. Add following Dojo modules to your XPage.
<xp:this.resources>
        <xp:dojoModule name="extlib.dijit.ExtLib"></xp:dojoModule>
        <xp:dojoModule name="extlib.dijit.Loading"></xp:dojoModule>
</xp:this.resources>
 

2. Add following lines to the EventHandler of your button/link which is going to be used for Partial Update:
<xp:this.onStart><![CDATA[XSP.startAjaxLoading()]]></xp:this.onStart>
<xp:this.onComplete><![CDATA[XSP.endAjaxLoading()]]></xp:this.onComplete>
<xp:this.onError><![CDATA[XSP.endAjaxLoading()]]></xp:this.onError>

That’s all !

A similar “Please wait..” dialog will appear and will display the page again once the Partial Update is complete..

image