Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 974

Stop navigating to another view

$
0
0

Hi,

 

I am trying to show a messageBox before navigating from a view. If user selects "YES", navigation can continue. I tried the following code. The code gets triggered but I couldn't stop it from leaving. The messageBox didn't show up:

 

this.getView().addEventDelegate({  onBeforeHide: function(evt) {       var bCompact = oController.getOwnerComponent().getContentDensityClass() === "sapUiSizeCompact";       var pMBMessage = oController.getView().getModel("i18n").getResourceBundle().getText("createDtlCancelMssg");       var pMBTitle = oController.getView().getModel("i18n").getResourceBundle().getText("attention");       MessageBox.confirm(            pMBMessage, {                 styleClass: bCompact ? "sapUiSizeCompact" : "",                 title: pMBTitle,                 icon: sap.m.MessageBox.Icon.WARNING,                 actions: [sap.m.MessageBox.Action.YES, sap.m.MessageBox.Action.NO],                 onClose: function(oAction) {                      if (oAction === sap.m.MessageBox.Action.YES) {                           oController._clearView();                           oController.navigateToFirstItem(oController);                      }else{                            return false;                      }                 }             }       );     }  });

I tried adding "return false;" but it didn't work.


Viewing all articles
Browse latest Browse all 974

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>