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

MenuBar in sapui5

Hi All,

I have been trying to develop a simple page with SAPUI5 controls. I have created a Menu Bar and Menu Bar Items with the following kind of code.

var oMenuBar = new sap.ui.commons.MenuBar("menuBar");

var oMenuBarItem1 = new sap.ui.commons.MenuItem("menuBar-item-1",{text:"Home", enabled: true});

oMenuBar.addItem(oMenuBarItem1);

A Menu called "Home" is created. Now if I click on this Menu, it should go to another page. What methods are used to add hyper links to menu items? Can you suggest a sample code?

Thanks & Regards,

Saranya

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jan 03, 2014 at 11:15 AM

    Hi,

    You could attach select event and navigate to an url:

    oMenuBarItem1.attachSelect(function navigateEntireToUrl(evt) {

    document.location = 'http://www.your_url.com';

    });

    Kind regards,

    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.