AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using In-Place Refresh

To refresh pagelet content in place, without affecting other content on the page, use the ALI Scripting Framework to implement in-place refresh.

Many pagelets display data that is time sensitive. In some cases, users should be able to navigate across links within a portlet without changing or refreshing the rest of the portal page. You can refresh portlet content on command, associate the refresh action with an event (refreshOnEvent), or program the portlet to refresh at a set interval (setRefreshInterval). The ALI Scripting Framework also contains methods for expanding and collapsing portlets.

In the simplified example below, the refresh portlet displays a "Refresh Portlet" button. Clicking the button updates the date and time displayed in the portlet. (The refresh button in the portlet header is an optional feature available in ALI portal only, configured on the Advanced Settings page of the Web Service Editor.)

The in-place refresh is executed by calling the refresh() method on the portlet object instance. The portlet reference can be retrieved by GUID, ID or name, available via the IDK IPortletRequest interface. You can also set a new URL to be displayed within the portlet upon refresh by using setRefreshURL or passing in a new URL when you call refresh. (The title bar cannot be altered on refresh.)

<div style="padding:10px;" align="center">
<p><button onclick="refresh_portlet()">Refresh Portlet</button></p>
<p><b>Current time is:</b><br> <span id="refreshTimeSpan"></span></p>
</div>
<pt:namespace pt:token="$PORTLET_ID$" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>

<script type="text/javascript"> 
function refresh_portlet()
{
var refreshPortlet = PTPortlet.getPortletByID($PORTLET_ID$);
if (!refreshPortlet)
  {
  refresh_debug('Could not locate PTPortlet object which corresponds to <b>Refresh Portlet</b> on page.');
  return;
  }
refresh_debug('<b>Refresh Portlet</b> calling refresh() method.');
refreshPortlet.refresh();
}

function refresh_debug(str)
{
if (window.PTDebugUtil) 
  { 
  PTDebugUtil.debug(str); 
  }
}

var t = new Date();
document.getElementById('refreshTimeSpan').innerHTML = t;
</script>

  Back to Top      Previous Next