Skip to Content
Author's profile photo Former Member

Menu Item in JS

Hi,

Below is the JS coding for Menu List in JS

var oMenu = new sap.ui.unified.MenuItem({

  text:”Menu1″,

  icon:”sap-icon://accept”

  })

  var oSubMenuList = new sap.ui.unified.MenuItem({

  text:”SubMenu1″,

  icon:”sap-icon://edit”

  })

  var oSubMenu = new sap.ui.unified.Menu({

  items:[

        oSubMenuList

        ]

  })

  var oMenu1 = new sap.ui.unified.MenuItem({

  text:”Menu 2″,

  icon:”sap-icon://accept”,

  submenu:[oSubMenu]

  })

  var oMenuSet = new sap.ui.unified.Menu({

  items:[

        oMenu, oMenu1

        ]

  })

  var oButton = new sap.m.Button({

  text:”Select”,

  press:function(oEvent)

  {

  var oEventTrigger = oEvent.getSource();

                this._menu = oMenuSet;

                var oDock = sap.ui.core.Popup.Dock;

                this._menu.open(false, oEventTrigger, oDock.BeginTop, oDock.BeginBottom, oEventTrigger);

  }

  })

Link: http://output.jsbin.com/wanero

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.