I have a dialog in my sapui5 application which when the "Yes" option is selected the user is taken to the home view, but it is saying my function is undefined. Am I calling the function from within the dialog in correctly?
Heres my code:
Load home view function:
loadHome : function() {
this.router = sap.ui.core.UIComponent
.getRouterFor(this);
this.router.navTo("HomePage");
},
My dialog:
cancelDialog : function() {
var oDialog1 = new sap.ui.commons.Dialog();
oDialog1.setTitle("Cancel Case");
var oText = new sap.ui.commons.TextView(
{
text : "Are you sure you want to cancel? Case data will not be saved"
});
oDialog1.addContent(oText);
oDialog1.addButton(new sap.ui.commons.Button({
text : "Yes",
press : function(){
this.loadHome();
}
}));
oDialog1.addButton(new sap.ui.commons.Button({
text : "No",
press : function() {
oDialog1.close();
}
}));
oDialog1.open();
},
both of these functions are withing the create controller. Thanks for any help