OpenWGA 7.10 - TMLScript reference

TMLContext "this"
Method :

portletByPath(pathExpression)

On object TMLContext "this"
Usage Retrieves a portlet by a portlet path expression
Description

This retrieves any portlet in the portlet hierarchy by a so called "path expression", which allows to navigate the portlet hierarchy for a special portlet to be retrieved.

A path expression consists of one or more single path expressions, divided by a slash. The retrieval of the (first) single expression uses the current portlet for reference when the expression is relative. If more expressions are specified then every expression uses the portlet that the previous expression returned as reference for relative operations.

Beginning the expression with a slash means that the evaluation starts at the root portlet, not the current portlet.

Valid expressions:

  • .. (double dot) - The parent portlet of the reference portlet
  • [name:]name - An immediate child portlet of the given name. You can omit the "name:" qualifier.
  • parent:name - A portlet in the parent line of the given name. Will iterate through parents until one with matching name is found.

Parameters

pathExpression (String):

Either one single of the valid expressions or multiple expressions divided by slashes

Return value Either a portlet adressed by the path expression or null if no such portlet cound be found (TMLPortlet)
Allowed in script types
  • WebTML pages and normal WebTML actions
Examples

Fetching a "sibling" portlet of name "nav":

portletByPath("../nav");

Fetching a first level portlet of name "main". Note the slash at the beginning:

portletByPath("/main");

Fetching a parent portlet of name "main", no matter if it is my parent portlet, my parents parent portlet or even further up the portlet hierarchy:

portletByPath("parent:main")