Skip to Content
-1

Uncaught TypeError: I.fFunction.call is not a function error in OnAction Menubuttion

Hi Experts,

I am trying to create a menubutton with someitems in it and when item is selected based on the item selected it should call another url but when ran the code i am getting Uncaught typeerror.

Below is the code

var oMenu = new sap.m.Menu({
title: "Items",
itemSelected: "onMenuAction"
});

oMenu.addItem(new sap.m.MenuItem("item1",{
text: "

item1

"
}));

oMenu.addItem(new sap.m.MenuItem("item2",{
text: "items2"
}));

oMenu.addItem(new sap.m.MenuItem("item3",{
text: "items3"
}));

var oRendererExtensions = jQuery.sap.getObject("sap.ushell.renderers.fiori2.RendererExtensions");
var content = [
new sap.m.ToolbarSpacer(),
new sap.m.MenuButton({
text: "Items",
menu: oMenu,
onMenuAction: function(oEvent){
var oItem = oEvent.getParameter("item");
var sItemPath = "";
while (oItem instanceof sap.m.MenuItem) {
sItemPath = oItem.getText() + " > " + sItemPath;
oItem = oItem.getParent();
}
sItemPath = sItemPath.substr(0, sItemPath.lastIndexOf(" > "));
sap.m.MessageBox.warning("Action triggered on item: " + sItemPath);
console.log("Action triggered on item: " + sItemPath);
}
})
];
console.log("Menu content: " + content);

if (oRendererExtensions) {
var toolbar = new sap.m.Toolbar({
content: content
});
oRendererExtensions.addSubHeader(toolbar);
}

Can anyone suggest what needs to be modified ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers