+

Search Tips   |   Advanced Search


Change portlet mode and window state on the client side

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

In client-side aggregation, you 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. You can adapt the CSA theme and skin to write your 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.

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 topic:

The client side portlet programming model


Related tasks


Getting started with the client side programming model for portlets
Handling portlet preferences on the client
JavaScript namespacing - observing good practice