Select language:

Client Events

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 the Open in new window option of the iView tray.

Parameter

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SourceCodeLine><SCRIPT language="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "expand", 
    {Id:"&lt;%=componentRequest.getComponentContext().GetContextName()%>"
    , Window:null})
  ...
// For external iviews
   EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "expand",
    {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "refresh",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "refresh", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "reload", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SourceCodeLine><SCRIPT language="JavaScript">
   ...
// For Java portal components:
 EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "personalize",
   {Id:"&lt;%=componentRequest.getComponentContext().GetContextName()%>",
   Window:null})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "personalize", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "remove",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "remove", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "help",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "help", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

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

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "adjustHeight",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null})
 
// For external iViews
 EPCM.raiseEvent("urn:com.sapportals:pagebuilder", " adjustHeight ", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

Type

Description

id

String

iView ID of the iView

Window

Object

The HTML window object of the iView

Example

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "recalcTray",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", " recalcTray ", 
   {Id:null, Window:self})
   ... 
<SCRIPT>
            

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

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

<SCRIPT language ="JavaScript">
   ...
// For Java portal components:
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "addOption",
   {Id:"<%=componentRequest.getComponentContext().GetContextName()%>",
    Window:null, Caption:"New Option", Func:"alert('new option')"})
 
// For external iViews
  EPCM.raiseEvent("urn:com.sapportals:pagebuilder", " addOption ", 
   {Id:null, Window:self, Caption:"New Option", 
    Func:"alert('new option')"})
   ... 
<SCRIPT>