[SAPUI5] Busy Dialog

onInit: function () {
	this._oModel = this.getOwnerComponent().getModel();
},

onButtonPress: function (oEvent) {
	//get Data
	var sPath = oEvent.getSource().getBindingContext().sPath;
	var oData = this.getView().getModel().getObject(sPath);
	var that = this;

	//busy on
	this._busyDialog = new sap.m.BusyDialog({});
	this._busyDialog.open();

	//create
	this._oModel.create("/DataSet", oData, {
			success: function (oData) {
					that._busyDialog.close();
					sap.m.MessageToast.show(that.getResourceBundle().getText("ok"));
			},
			error: function (oError) {
					that._busyDialog.close();
					sap.m.MessageToast.show(that.getResourceBundle().getText("nok"));
			}
	});
},

Leave a Reply

Your email address will not be published. Required fields are marked *