OpenWGA 7.10 - JavaScript reference

Method :

WGA.event.addListener(pKey, eventName, f)

On object WGA.event
Usage Listen for portlet events of the given name

This method registers a JavaScript function which will get called when the portlet event is fired. This function is called with an "event object" as parameter.

It is especially suited to catch portlet events that were already fired on the client side via WGA.event.fireEvent().

The event object has the following properties:

  • name: the name of the event
  • source: the source of the event, normally the portlet key of the portlet that fired it
  • params: a JavaScript object with the event parameters sent by WGA.event.fireEvent()

It is neccessary to assign the listener to a WebTML portlet of the current page. The registration code should be in the output code of this portlet, so the registration runs every time the portlet gets reloaded. The WGA portlet registry will register the event for that portlet and will remove it from the registry once this portlet gets reloaded or unloaded.


pKey (String):
The key of the portlet which the event script belongs to

eventName (String):
The Name of the event

f (JavaScript Function):
function to be called when the event fires

Writable False
Return value none

Script code adding a listener function which calls an WebTML AJAX action when an event fires.

<tml:form id="myform" source="portlet">

  <tml:input type="hidden" name="key"/>



"<tml:script expression="portlet.portletkey"/>"




WGA.ajax.callAction("<tml:action ref="$store"/>")