/scripts/ahub.form.attachments.js
0

SAPUI5: sap.m.MenuButton is not a constructor

Jul 02, 2017 at 06:58 AM

117

avatar image

Hello Experts,

I am trying to run a SAPUI5 application that I wrote but I receive the following error:

sap.m.MenuButton is not a constructor

My code snippet:

		var oBar = new sap.m.Bar({});
		...
		oBar.addContentLeft(new sap.m.MenuButton({tooltip: "{i18n>generic.Refresh}", press: function() { }, icon: "sap-icon://generic/refresh", buttonMode: "Split"}));
...



Any suggestions?

Regards.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Effi Olivkovitch Jul 02, 2017 at 08:39 AM
0

Okay, I figured it out...

I was missing the following library declaration:

data-sap-ui-libs="..., sap.ui.unified, ..."
Share
10 |10000 characters needed characters left characters exceeded
Frank Schuler
Jul 02, 2017 at 07:20 AM
-1

Hello Effi,

Please check the sap.m.MenuButton documentation in the SAPUI5 Explored application:

Best regards

Frank


sapmmenubutton.png (46.2 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Frank,

Thank you for your answer.

I took the code that I wrote & put it in JS Bin. It is working.

...

    var page = this.getView().byId("page");
    page.setCustomHeader(new sap.m.Bar({
      contentLeft: [
        new sap.m.ToolbarSpacer(),
        new sap.m.MenuButton({tooltip: "Test", press: function() {  }, icon: "sap-icon://play", buttonMode: sap.m.MenuButtonMode.Split}),
        new sap.m.Button({
          text: "Next"
        })
      ]
    }));

...

For some reason, it does not work when I deploy it on my server (SAP Netweaver 7.5).

0
Skip to Content