on 04-29-2016 10:33 AM
I am performing a create operation from my UI5 application with below code , and wanted to throw a success/failure message to users. The create operation is successful though, but the message is nt coming up for users.
Is there any additional parameters that are to be added?
Create: function(evt) {
var oModel = this.getView().getModel();
sap.ui.getCore().setModel(oModel);
var requestBody = {};
requestBody.abc = 'abc';
requestBody.cde = 'cde';
oModel.create('/EntitySet', requestBody, null, function()
{ sap.m.MessageToast.show(" Created Successfully", { duration: 2000 }); },
function() { alert('failed'); });
}
Thanks in advance
kumar
Try it with this syntax (naming the callback functions):
oModel.create("/EntitySet", oEntry, {
success : function(oData, oResponse) {
// Success
sap.m.MessageToast.show(" Created Successfully" );
}
error : function(oError) {
// Error
sap.m.MessageToast.show(" Creation failed" );
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
your code seems correct.put an alert inside success function and see if its being called.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.