SAPUI5 Page Event navBack() Ignored

Hello:

I've been looking around unable to find a solution to my problem that I expose now requesting for your kind help:

I have a SAPUI5 App with an XML View with a Page:

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml"
	controllerName="my_controller_name" id="my_id">
	<Page id="__Pageid" title="{i18n>Title}" showNavButton="true" navButtonPress="onCustomNavBack">
<content> ..... </content>

Now in my View there is a field that I want to validate and if the validation is successful the I run another checks, for that I subscribed a function to the validationSuccess event of the field in the onInit of the View Controller (this happens automatically every time I leave the field and the validation is OK):

onInit: function() { ...
  var oRouter = this.getRouter();
  var oView = this.getView();
  oView.byId("__input3").attachValidationSuccess(function() {
				this.updateCurrency();
				oView.getModel().submitChanges({
					success: function(oData, Response)                                          {...}
				});
   }.bind(this));
}

Now, I also have the navBack event of the page implemented in the same controller like:

onCustomNavBack: function(oEvent) {
			var that = this;
			if (that.getView().getModel().hasPendingChanges()) {
				that.getView().setBusy(true);
				that.getView().getModel().submitChanges({
					success: function(oData, Response)                                          {...} 
                                });
                         }
}

Now the problem is that if in the screen I enter the field and update some input and leave directly to the back button without clicking outside or anything, the App should validate and after that execute the navBack content, but instead is doing the attachValidationSuccess and ignoring the navBack button that was clicked, and this is wrong for me. Therefore I suppose that I must be doing something bad and came here for some advice.

Regards!!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers

Skip to Content