cancel
Showing results for 
Search instead for 
Did you mean: 

How to call "navigation panel collapse" event

Former Member
0 Kudos

Hi,

I need to create a link (in a jsp) to forced the navigation panel to collapse itself.

To do this in my jsp, I get back the script reference of the standard pageToolBar.par and I call the same javascript function as the one call by it.

So I have:

    • The reference script:

<script language='JavaScript' src='<%=componentRequest.getResource("com.sap.portal.layouts.framework", IResource.SCRIPT, "scripts/scenario/WAandNavPanel.js").getResourceInformation().getURL(componentRequest)%>'></script>

And the function called:

expNavPanel_onclick();

But it still does not work ...

Has somebody any idea ?

Thanks,

Fabien

PS: How can I forced other event as: call pageToolBar personnalize window ...?

Accepted Solutions (1)

Accepted Solutions (1)

darrell_merryweather
Active Contributor
0 Kudos

You are correct, this method is in the javascript file, however, as long as you are using the standard portal this Javascript file is already included in the output to the browser. Therefore you would probably need something like the following

<script>

innerPage= "pcd:portal_content/com.sap.pct/every_user/general/com.sap.portal.frameworkpage/com.sap.portal.innerpage";

innerPageWindow = pageSupport.getIvuFrameWindow(innerPage);

innerPageWindow.collapsePanel();

</script>

Former Member
0 Kudos

Hi Darell,

I've tried to use the code (with some modification) you told me.

But nothing happens.

What ever I try to use in the Page Builder Client API (ivuPersonalize, getIvuId, ...) doest not work.

Is there something special to import or to use before calling this API ?

Thanks,

Fabien

darrell_merryweather
Active Contributor
0 Kudos

Hi

I just created a test component, which I have pasted the code below. This works fine. It basically consists of one line of Javascript. Now, depending on whether the iView is URL or EMBEDDED depends on which code you use.

I have tested both of the versions below and they work fine. I have only tested these when the iView is on a page and the page added to the workset.

I hope this helps

Darrell

EMBEDDED IVIEW

==============

public class CloseNavPanel extends AbstractPortalComponent{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response){

StringBuffer output = new StringBuffer();

output.append("<a href=\"\" onClick=\"collapsePanel();return false;\">Close Nav Panel</a>\n");

response.write(output.toString());

}

}

URL IVIEW

=========

public class CloseNavPanel extends AbstractPortalComponent{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response){

StringBuffer output = new StringBuffer();

output.append("<a href=\"\" onClick=\"parent.collapsePanel();return false;\">Close Nav Panel</a>\n");

response.write(output.toString());

}

}

Former Member
0 Kudos

Hi Darell,

Thanks you for your response ..

This is what I have tried to do but it is not working.

In fact, the error can come from the fact that I would like to put the link (to collapse navigation window) in a specific toolbar iview that I have already created.

The iview does not belong to the inner page so I think it does not have the visibility of the javascriptfile or the navigation component.

Because I have made the test to copy the javascript file "WAandNavPanel.js" in my iview application, and when I call the function "collapsepanel", a NULL error is coming when trying to get the element by id "nav_panel_div"...

Do you have a idea ?

Thanks,

Fabien

darrell_merryweather
Active Contributor
0 Kudos

Hi

The iView that you have created, where exactly has it been put. It will have visibility of the javascript file somewhere, as the portal loads this as part of the complete page builder cycle. DO NOT include the javascript file in your own component, as it probably has references to other javascript objects which do not have visibility from your iview.

So, where exactly is your iView. You say it isn't part of the innerpage, but anything that is placed below the top level navigation is part of the innerpage. If you could explain where exactly it has been put I may be able to help

D

Former Member
0 Kudos

Hi,

As you say: anything that is placed below the top level navigation is part of the innerpage.

But the one I use is put on the top on the level navigation.

I have:

1. A specific Masthead

2. A specific Toolbar (where is my iView)

3. The top level navigation

4. The inner page

So my Iview is not under the inner page ...

Thanks for your help,

Fabien

darrell_merryweather
Active Contributor
0 Kudos

Hi

Lets try another variation then. I have tried this and it also works

Put the following script into your component that is displayed in the masthead (or actually it can be anywhere)

<script language="JavaScript">

innerPage= "pcd:portal_content/com.sap.pct/every_user/general/com.sap.portal.frameworkpage/com.sap.portal.innerpage";

innerPageWindow = top.pageSupport.getIvuFrameWindow(innerPage);

innerPageWindow.collapsePanel();

</script>

I hope this works

Former Member
0 Kudos

Hello Darell,

Can you tell me what ius the property of your test iView?

Because mine is EMBEDDED and some function as getIvuFrameWindow do not work with such an iView ....

Thanks,

Fabien

darrell_merryweather
Active Contributor
0 Kudos

Fabien

Do you mean that the innerpage is embedded. The code that I provided above retrieves the frame for the innerpage frame and not the iview frame.

Basically you should be able to find out where the WAandNavPanel.js is and call the closepanel mathod from there. The only way to find this is to find out which frame contains this javascript file. Normally this is the innerpage, which is why the code above retrieves the innerpage frame and then calls the closepanel method.

I hope this helps

Darrell

Former Member
0 Kudos

Hello Darren,

It is working,

Thanks,

Fabien

Former Member
0 Kudos

Hello Darell,

By chance, have you an idea of how I could call the personnalize window of the pageToolbar ...?

I've tried:

var toolbarIvu = "pcd:portal_content/every_user/com.sopra.test_fco/desktop_portal_test_id/frameworkPages/frameworkpage/com.sap.portal.pageToolbar";

top.pageSupport.ivuPersonalize(toolbarIvu);

Without success ....

Thanks,

Fabien

darrell_merryweather
Active Contributor
0 Kudos

Have you tried this javascript

parent.pageTitleBar.PersonalizePage(true)

D

Former Member
0 Kudos

Hi,

I've tried, but it did not work.

But I've found:

var toolbar = parent.pageTitleBar;

EPCM.raiseEvent("urn:com.sapportals:pagebuilder", "personalize", );

And this works ...

Thanks,

Fabien

Answers (1)

Answers (1)

darrell_merryweather
Active Contributor
0 Kudos

Hi

you can call the Javascript method collapsePanel() which should collapse the navpanel

I hope this helps

Darrell

Former Member
0 Kudos

Hi Darell,

But do you need to import the javascript file reference in your application ?

Because the declaration of this function is in the file

WAandNavPanel.js which I refer to, as I explain in the previous message.

But it still does not work ..

Regards,

Fabien