cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5: sap.m.MenuButton is not a constructor

former_member286225
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member286225
Participant
0 Kudos

Okay, I figured it out...

I was missing the following library declaration:

data-sap-ui-libs="..., sap.ui.unified, ..."

Answers (1)

Answers (1)

architectSAP
Active Contributor
0 Kudos

Hello Effi,

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

Best regards

Frank

former_member286225
Participant
0 Kudos

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).