I'm creating simple SAP Fiori application using OData v2 model. I've done implementation of .create(...) request and it works on backend system, but I have a problem with success callback function.
After new object creation I want to display Message Toast with its number and go back to previous view.
How can I use objects from _createNotification function inside success / error (_onBatchError) callback?
_createNotification: function() {
var oModel = this.getModel();
var that = this;
// ....
oModel.create("/NotificationHeaderSet", oNotification, {
success: function(oData, oResponse) {
MessageToast.show(oData.NotificationNo); // How to get i18n ?
// this.getRouter().navTo("worklist", {}, true);
},
error: this._onBatchError
});
}
this, that, oModel
are undefined and sap.ui.core.getCore().getModel()
gives null (outside this callback default / i18n model is handled fine)
Probably it is some dummy error, but I'm out of ideas.
Many thanks in advance. Jakub