This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 21, 2011, 2:14 PM
8 Posts

Periodic refresh of a view on an XPage

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: refresh xpage view period
  • Replies: 4
I would like my Xpage to refresh a view automatically at intervals of 10 seconds.
Other than clicking a button to do a partial refresh, I can't see how to do it automatically. 
I am feeding new documents to the view via Notes Forms BTW.
 
If anyone can help I'd be very grateful. 
Mar 21, 2011, 3:40 PM
33 Posts
Re: Periodic refresh of a view on an XPage
Hi
 
I do not believe XPages has a timer control to automatically partial refresh at the moment.  This would certainly be a welcome addition. 
 
You may be able to write something in AJAX to do this..
 
I've found some code to automatically do the whole page though... 
<script type="text/javascript">
setTimeout(function() { window.location.reload(); }, 30000);
</script>
 
Hope this helps
Ian  
Mar 21, 2011, 5:40 PM
122 Posts
Re: Periodic refresh of a view on an XPage
Ian's code is fine. If you want to make it a bit more seamless to the user, then instead of reloading the whole document you could use
XSP.partialRefreshGet("#{id:myPanelId}");
This will just perform a partial refresh of the relevant area of the screen.
Mar 22, 2011, 10:42 AM
33 Posts
Re: Periodic refresh of a view on an XPage
Paul
 
Good point.  That works much better if it isn't the entire page you want to reload.  I set my panel to 30 seconds. 
 

<xp:scriptBlock id="scriptBlock2">

<xp:this.value>

<![CDATA[

setInterval(function() {

XSP.partialRefreshPost("#{id:<name of my panel>}", {

onStart: null,

onComplete: null,

onError: null

})

}, 180000)

]]>

</xp:this.value>

</xp:scriptBlock>

 
Mar 22, 2011, 4:18 PM
8 Posts
Re: Periodic refresh of a view on an XPage
Thankyou all for your input.
I have tried the partialRefreshGet method and this works OK.
 
However, I have several views on my page (each embedded in custom controls) and sometimes one of them (always the same one) doesn't refresh automatically. It's a bit strange and I'm not sure why.
I recall seeing a post somewhere that multiple views on the same page can cause problems?
Running 8.5.2 BTW. 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal