Hi all,
I have a question.
What's the diff between JSON model and Odata model(JSON format).
If I need a JSON model from back-end, can I just use JQuery/AJAX instead of using UI5 OData APIs?
Request clarification before answering.
>>If I need a JSON model from back-end, can I just use JQuery/AJAX instead of using UI5 OData APIs?
If you need to use plain JSON data from backend you will not be able to use odata model as there is no metadata.
in case of odata with json format ($format=JSON) you can use jquery ajax, you just have to explicitly handle xsrf token
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the two models have different features when it comes to data handling. The JSONModel is better for client-side data container, because you can very easily add, remove entrys. The ODataModel has nice features when it comes to data transfer between the client and server. Based on the binding you make to a control, it makes automatic requests to the server for getting data. You can also add filters, expand deep entities, etc. I suggest you take a look at the APIs of the two models.
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.json.JSONModel
Yes, you can also use JQuery/AJAX,like this:
jQuery.ajax({
type :'POST',
url : yourURL,
headers : oHeaders,
cache : false,
contentType : yourContectType,
processData : false,
data : yourDataObject,
success : _handleSuccess,
error : _handleError,
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.