+

Search Tips   |   Advanced Search

Change portlet mode and window state on the client side


The client side programming model allows us to handle portlet mode and window state changes entirely on the client, rather than requiring a full server-client roundtrip.

In client-side aggregation, we can provide an event handler for changes of portlet mode and portlet window state. This handler gets called when a mode change or a window state change is triggered.

This function is currently only supported in the portal CSA theme and the CSA skin. We can adapt the CSA theme and skin to write our own custom themes and skins to support this feature. The return value of your handler determines whether or not the default action is executed:

This allows the portlet to handle these changes entirely on the client, with no server interaction.

You define the change handlers as follows:

The CSA skin checks whether such a function is defined before processing any portlet mode or window state changes. The handler function provides two arguments:

Refer to the following example:

<portlet:namespace/>doPortletMode( portletMode, div )
{     var retVal = true;
   if ( portletMode == ibm.portal.portlet.PortletMode.VIEW ) 
   {
      //do view mode here       
      div.innerHTML = “...some view mode markup...”;
      retVal = false;
   }
   return retVal;
   }


Parent: The client side portlet programming model
Related:
Get started with the client side programming model for portlets
Handling portlet preferences on the client
JavaScript namespacing - observing good practice