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

Navigation Tree event on a link

Hello everybody,

I have a Navigation tree and I want to put an event on a link. How could I do that ?

I have the following code:

..

..

..

private void CreateLink(
			IPortalComponentRequest request,
			TreeNode treeNode,
			INavigationNode node)
		{
			String url = node.getName();
			String title = node.getTitle(request.getLocale());
			Link link = new Link("LINK_" + FirstNodeCount++, title);
			String navigationAction = "EPCM.doNavigate('" + url + "',2)";
			//l.setOnClientClick(navigationAction);
			link.setOnClick("onLink");
			treeNode.setComponent(link);
		}

and

public void onLink(Event event)
		{
			TreeNodeSelectEvent myEvent =  (com.sapportals.htmlb.event.TreeNodeSelectEvent) event;
			TreeNode myNode = navigationBean.getTree();
			System.out.println(myNode.getID());
			TreeNode tempNode = myNode.getNodeByID(myEvent.getNodeKey());
			myNode.setOpen(true);
			navigationBean.setTree(myNode);
		}

Thanks for any feedback

Regards.

Altafin

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2005 at 03:34 AM

    try link.setOnClientClick("javascript:raiseEvent('" + url + "')");

    instead of link.setOnClick("onLink");

    Include the javascript to fire the event.

    <SCRIPT language=javascript>

    function raiseEvent(value){

    EPCM.raiseEvent("urn:com.sap:PassEvent", "SetParam", value, null);

    }

    </SCRIPT>

    Then add the subscribe event to the iview you want to receive the event.

    <SCRIPT language=javascript>

    EPCM.subscribeEvent("urn:com.sap:PassEvent", "SetParam", getEvent);

    function getEvent(eventObject){

    EPCM.doNavigate('" + eventObject.dataObject + "',2)";

    }

    </SCRIPT>

    Add a comment
    10|10000 characters needed characters exceeded

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.