on 02-17-2014 12:50 PM
Hi,
In my sapui5 app, I have an animation made by progress indicator which is running while waiting for the response of an OData model .create() service. However, the animation stops after the request is sent.
Does anyone know how to make an async .create() OData request?
Thanks a lot!
My code look like this:
oODModel = new sap.ui.model.odata.ODataModel(myUrl);
oEntry = myNewDataEntry;
myAnimationIndicator.start(); //animation starts to run
var onSuccess = function(){myAnimationIndicator.stop();};
var onError = function(){myAnimationIndicator.stop();};
oODModel.create('myDataSet',oEntry, null, onSuccess, onError);
Hi ,
Please pass true in the call creat(sPath, oData, oContext?, fnSuccess?, fnError?, true) to make async request.
Thanks,
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
You can give it a try with the below snippet which is working fine for me.
var onSuccess = function(){myAnimationIndicator.stop();};
var onError = function(){myAnimationIndicator.stop();};
var reqHeaders = {
context: this,// mention the context you want
success: onSuccess, // success call back method
error: onError, // error call back method
async: true // flage for async true
};
// show the loader here
myAnimationIndicator.start();
oODModel = new sap.ui.model.odata.ODataModel(myUrl);
oEntry = myNewDataEntry;
oODModel.create('myDataSet',oEntry, reqHeaders );
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
According to the SAPUI5 documentation:
Was not released until Version 1.20
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try to place odatamodel.create in
window.setTimeout(function() { <HERE> }, 100);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dong,
y do u need 1.19?
1.18 supports that feature, as you can see here: SAPUI5 SDK - Demo Kit
And download is available here: OpenUI5 - Download
Greets,
ben
Hi,
Now I have updated sapui5 to 1.18.10, but the progressindicator animation is still not running while waiting for the resp, though I set async for .create() req. Has anyone tried similar thing before?
The animation is started by calling a function, say, startIndicator(), which actually running in an infinite loop showing the moving progress bar. I wonder teh problem is due to the way how to start the indicator while sending the req.
Thanks.
Dong
Hi,
try
oODModel.create('myDataSet',oEntry, null, onSuccess, onError,true); //true sets asyn
The last paramter is a boolean, which decides to be async or sync.
Regards
Sakthivel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sakthivel,
Thanks for the quick reply. But I looked the API:
creat(sPath, oData, oContext?, fnSuccess?, fnError?)
Trigger a POST request to the odata service that was specified in the model constructor.
which does not seem to have a flag bAsync param. Anyway, I will have a quick try.
Br,
Dong
Hi Dong,
I'm referring to the UI5 1.19.1 Version. Here's the API
Regards
Sakthivel
Hi Sakthivel,
I am using SAPUI5 1.14.6, no wonder why the API is different. Thanks very much for the info.
By the way, can you paste the API lines of .creat() method? I cannot open the site now. Just want to see the details of the method.
Br,
Dong
P.S:
@SAP: I sincerely hope the latest changes of API can be reflected on the official website which we developers use serioesly. Thanks very much in advance!
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.