on 10-23-2015 10:57 AM
There are various ways by which we can call an Odata webservice in our fiori/ui5 application for eg. using Odata model or by using Jquery Ajax.
Which of the method is preferred in different circumstances and what are the advantages/disadvantages which needs to be considered while deciding the approach.
Regards
Amber
Hi,
The UI5 models use jQuery.ajax themselves which you can see if you delve into the .js files (e.g. resources\sap\ui\model\json\JSONModel.js).
The main advantage to using a model is that it holds your data and you can bind your UI5 controls to it - suggest you check out this link for more informationhttps://sapui5.netweaver.ondemand.com/sdk/#docs/guide/Introduction.1.html
There may be certain situations where you would want to use your own jQuery.ajax call, for example posting data from your application to a web service.
all Model which is introduced in sapui5 internally use same concept as jQuery Ajax.
1. jQuery Ajax is a hard coded process. Via this checking return data type, Accordingly Parsing and Binding of data is your responsibility.
2. Using Model is beast practice when you know your services return data type,According that you can bind directly and use it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Amber
sap.ui.model.odata.ODataModel shall be the model to use when your UI needs to interact with oData service. It is very difficult to "talk" to the oData service with jQuery.ajax. The sap.ui.model.odata.ODataModel provides you with the necessary functions.
If the service is not oData based, then we have to discuss more.
Thanks
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amber,
ODATA Model is preferable.
1. OData protocol is that it is becoming an OASIS standard
2. Next version of the OData protocol (v4) it is planned to support delta queries as part of the standard
3. Use OData models instead of normal Ajax calls. Odata Models are tightly integrated to the UI5 controls also. When the data changes, all the controls will be updated automatically.
Thanks,
Karthik A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.