Show TOC

Syntax documentationClient Events Locate this document in the navigation structure

The events in this section are provided by the JavaScript EPCM object that exists on every portal page, when the EPCF service is activated.

External portal applications that have no EPCM object must use the regular page client API.

The events expect a parameter in the form:

{Id : "iview id" , Window : iview HTML frame window}

If Id is not null, the window parameter is ignored. This parameter was designed to support Java portal applications and external iViews that use the URL isolation mode.

Depending on the type of the iView, set the parameter as follows:

  • For a Java portal application, specify the iView Id and set the Window parameter to null.

  • For an external iView, set the iView Id to null and the Window parameter to self.

To get the iView ID, use the following method of the server-side Portal Runtime (PRT) API :

request.getComponentContext().GetContextName ();

For background information, see:

Isolation Methods

Client API

Enterprise Portal Client Framework (EPCF)

The page builder has the following events:

expand
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "expand", {Id:id, Window:window})

Opens an iView in a new window.

This event corresponds to theOpen in new window option of the iView tray.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SourceCodeLine><SCRIPT language="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "expand", 
  5.     {Id:"&lt;%=componentRequest.getComponentContext().GetContextName()%>"
  6.     , Window:null})
  7.   ...
  8. // For external iviews
  9.    EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "expand",
  10.     {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
refresh
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "refresh", {Id:id, Window:window})

Refreshes an iView. If the iView content is in the portal cache, it will be replaced by new content generated for this iView.

This event corresponds to the Refresh option of the iView tray.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "refresh",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "refresh", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
reload
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload", {Id:id, Window:window})

Reloads an iView. The iView content is retrieved from the portal cache.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
personalize
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "personalize", {Id:id, Window:window})

Starts the personalization dialog. This event corresponds to the Personalize option of the iView tray.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SourceCodeLine><SCRIPT language="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "personalize",
  5.    {Id:"&lt;%=componentRequest.getComponentContext().GetContextName()%>",
  6.    Window:null})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "personalize", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
remove
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "remove", {Id:id, Window:window})

Removes the iView from the page.

When the iView was added to the page by the user during personalization, the iView will be deleted from the page. When the iView was set on the page by the administrator, the iView will be hidden. The iView can be made visible again by the user during personalization.

This event corresponds to the Remove from page option of the iView tray.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "remove",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "remove", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
help
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "help", {Id:id, Window:window})

Starts the help component for the iView. This event corresponds to the Help option of the iView tray.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "help",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "help", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
adjustHeight
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "adjustHeight", {Id:id, Window:window, [,Height:height]})

Adjusts the height of the IFrame that contains the iView.

This event is only relevant for iViews using URL isolation mode. Use this event if you want the to resize the IFrame when the iView is resized. If you do not specify the height parameter, the IFrame height will be adjusted to the current size of the iView. This behavior is the same as of the iViews that have the automatic height property.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

height

Integer

Height of the IFrame

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "adjustHeight",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null})
  7.  
  8. // For external iViews
  9.  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", " adjustHeight ", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
recalcTray
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "recalcTray", {Id:id, Window:window})

Use for Web browsers other than Internet Explorer to adjust the tray size to the iView content.

Parameter Description

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "recalcTray",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", " recalcTray ", 
  10.    {Id:null, Window:self})
  11.    ... 
  12. <SCRIPT>
End of the code.
addOption
EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "addOption", {Id:id, Window:window, Caption:caption, Func:func})

Adds a new entry to the tray options menu.

For multilingual applications, you should enable translation of the caption parameter.

Parameter Description

Parameter

Type

Description

Id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Caption

String

Title of the option that is displayed in the option menu of the tray

Func

String

JavaScript code that will be executed when the option is chosen

Example

Syntax Syntax

  1. <SCRIPT language ="JavaScript">
  2.    ...
  3. // For Java portal components:
  4.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "addOption",
  5.    {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
  6.     Window:null, Caption:"New Option", Func:"alert('new option')"})
  7.  
  8. // For external iViews
  9.   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", " addOption ", 
  10.    {Id:null, Window:self, Caption:"New Option", 
  11.     Func:"alert('new option')"})
  12.    ... 
  13. <SCRIPT>
End of the code.