Skip to Content
author's profile photo Former Member
Former Member

How to use the Portal Javascript API?

Hello,

Can someone please show me a simple example of how to use the Portal JavaScript API. As far as I know I need to uae the EPCM object which provides this functunality.

For example here is the usage that SAP priveds for the getIvuId() Method:

<SCRIPT language ="JavaScript">

var myId = parent.pageSupport.getIvuId(self);

<SCRIPT>

Can someone please show me a full code example of how to use it correctly?

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Posted on Feb 06, 2005 at 09:35 PM

    Hi Roy,

    the code example you gave (just a hint: code can be marked as code, the SDN editor does support it, see button on the top of the editor) refers to the Page Builder Client Side API, see https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/using the new client side page builder features of ep6 sp2

    In contrast to this, EPCF just cares about other issues, see http://help.sap.com/saphelp_nw04/helpdata/en/ce/3e98408d953154e10000000a1550b0/frameset.htm

    Both documentations contain code examples.

    Hope it helps

    Detlev

    PS: Please consider rewarding points for helpful answers. Thanks in adcance!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2005 at 10:28 AM

    Hi,

    The link you sent me contains this JavaScript code in order to referance the pageSupport object:

    <SCRIPT LANGUAGE="JavaScript">
    
    var ivID='<%=componentRequest.getComponentContext().getContextName()%>';
    var pso;
    
    // URL isolated, so get the ID from pageSupport
    if (!window.pageSupport) 
    { 
        if (parent.pageSupport) 
        {
            ivID = parent.pageSupport.getIvuId(self);   
            pso = parent.pageSupport;
        }
    } 
    //Embedded or Pumped
    else 
    {
        pso = pageSupport;
    }
    
    </SCRIPT>
    

    The problem is that I can't referance this object, I always receive null when I try to use pso. Why is that and how can I get a referance to pageSupport?

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Roy,

      first, you are on EP6 SP2 or higher?!

      Second, right-click on a page (not: on an iView; so beneath the iView in question if URL isoldated), and look at the source code. There you should find something like

      <script SRC="/irj/portalapps/com.sap.portal.pagebuilder/optimizedscripts/pagesupport.js" ></script>

      Also many references the the pageSupport object.

      Please check these two things. If questions stay, come back.

      Hope it helps

      Detlev

  • author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2005 at 12:20 PM

    Hi,

    I am using NW 04.

    I found this line:

    <SCRIPT src="/irj/portalapps/com.sap.portal.pagebuilder/scripts/pagesupport.js"></SCRIPT>

    And added it to my JSP file but I still receive null instead og pageSupport object. Any idea why?

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Roy,

      > I found this line:

      Within the docu or within your page?

      Normally, when it's within the page, you don't have to add it to your iView. It has to be on the page.

      There must be somethin else strange. Maybe an error in NW implementation, but I would think that's probably some minor mistake on your site.

      Please minimize your example as far as you can: Use a JSPDynpage with nothing in it than the redirect to the JSP, within the JSP, do nothing in it than the things needed for the call of the pageSupport object, and a corresponding minimized portalapp.xml.

      Post them here in the thread (using code marker).

      And give additional info how the iView when you tested and still it didn't work has been isolated (URL/embedded). Also try to play with these settings by yourself.

      Hope it helps

      Detlev

  • author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2005 at 08:19 AM

    Hi,

    the code I sent before is the minimum code that can be setteed. I have a JSP with only a button that by pressing it should pop up an alert with the pageSupport object so I don't think minimizing the code is the issue here...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2005 at 08:21 AM

    By the way, I've tested it both with URL and Embedded isolation and it doesn't work. In addition, as you can see from the code above I handle both case but I still recive pageSupport as null...

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Roy,

      Try this ( I have tested and it works. )

      <%@ taglib uri="htmlb_tld" prefix="hbj" %>

      <hbj:content id="myContext" >

      <hbj:page title="PageTitle">

      <hbj:form id="myFormId" >

      </hbj:form>

      <script language="javascript">

      if(!window.pageSupport){

      if(parent.pageSupport){

      alert(parent.pageSupport + " exists when iView is set to URL isolation");

      }

      else{

      alert("parent.pageSupport does not exist");

      }

      }

      else{

      alert(window.pageSupport + " exists when iView is set to Embedded isolation");

      }

      </script>

      </hbj:page>

      </hbj:content>

      The "parent.pageSupport" will not exist if you have not added your iView to a Portal page.

      Hope it helps,

      - Teecheu

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.