Skip to Content
0

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

Nov 21, 2017 at 03:17 AM

211

avatar image

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 ?

10 |10000 characters needed characters left characters exceeded

was it resolved?

if so, please provide solution else reopon this question

0

The issue has been resolved.the syntax which i have used for menu button is incorrect.

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers