OpenWGA 5.4 - TMLScript reference


Object:

PortletEvent

Description This object represents an event that was thrown by a WebTML portlet and contains all its properties. It can be used to throw such an event. It also is available in portlet eventscripts to describe an event that was thrown.
Retrieval this.createEvent() to create a new portlet event that should be thrown
As object "portletEvent" or "portletEvents" In Event-Scripts defined by WebTML tag <tml:eventscript>
Allowed in script types
  • WebTML pages and normal WebTML actions
Properties and methods
Name Purpose
addParameter(name, value) Adds a parameter to the event
getParameter(name) Reads the value of a portlet parameter
name Name of the portlet event
sourceName Returns the name of the portlet that threw the event
Examples Example creating and throwing a portlet event in a WebTML action:
<tml:action id="fireEvent">

    var event = this.createEvent("myEvent");
    event.addParameter("myParam", "Hello world!");
    portlet.fireEvent(event);

</tml:action>


Example of an event script processing a thrown event. Paramter "myParam" is read from the implicit "portletEvent" object and stored in portlet configuration.
<tml:eventscript onevent="myEvent">
   
    portlet.setitem("eventParameter", portletEvent.getParameter("myParam"));
    portlet.save();

</tml:eventscript>