hi i am trying to display a message box and based on action on message box it should undergo the condition.
jQuery.sap.require("sap.m.MessageBox");
sap.m.MessageBox.show(
"Please Confirm to Submit", {
icon: sap.m.MessageBox.Icon.INFORMATION,
title: "Dear User",
actions: [sap.m.MessageBox.Action.YES, sap.m.MessageBox.Action.NO],
onClose: function(oAction){
if(oAction == "YES"){var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo('default');}
},
}
);
here i am trying to navigate to another view if i select YES button in message box.but it is not happening.can u help where i went wrong?
I think it should be
jQuery.sap.require("sap.m.MessageBox"); sap.m.MessageBox.show("Please Confirm to Submit", { icon: sap.m.MessageBox.Icon.INFORMATION, title: "Dear User", actions: [sap.m.MessageBox.Action.YES, sap.m.MessageBox.Action.NO], onClose: function(oAction) { if (oAction == "YES") { var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.navTo('default'); } }.bind(this) });
Thanks
-D
try,
if (oAction === sap.m.MessageBox.Action.YES) {
Hi Sunnel,
I don't see problem with your code. I have tested and i am able to close the message box.
Where exactly you are facing the issue.
Thanks,
Naga
if possible can anyone post an example in jsbin
Add a comment