Hi, I am working on a ui5/fiori app, I am trying to show a pop up when when user clicks on the default back button(See attachment). Popup will have two options 'Continue' and 'Cancel'. If user clicks on Continue button then I'd like to navigate to the previous page else if Cancel button is clicked then I want to stay on the same page. I've tried the below code I am able to see pop up(for a second) but the pop doesn't wait till user click on button. It closes immediately and it navigates to the previous page.
sap.ui.getCore().byId("backBtn").attachPress(function() {
debugger;
var bCompact; = !!this.getView().$().closest(".sapUiSizeCompact").length; MessageBox.warning( "Unsaved changes are lost, do you want to continue?.",
{ actions: ["Continue", sap.m.MessageBox.Action.CANCEL],
styleClass: bCompact ? "sapUiSizeCompact" : "", onClose: function(sAction) { MessageToast.show("Action selected: " + sAction); } } );