0% found this document useful (0 votes)
89 views

SAP UI5 Models and Binding: TCS Internal

Uploaded by

Balaji Murugesan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

SAP UI5 Models and Binding: TCS Internal

Uploaded by

Balaji Murugesan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

SAP UI5 Models and Binding

6/7/2017

Copyright 2012 Tata Consultancy Services Limited


1
TCS Internal
Types of SAP UI5 Models

1)ODATA Model
2)JSON Model
3)Resource Model

2
ODATA Model

It is a Server side model


Any changes on the client is directly reflected back to the
server, incase of update, delete and create
Syntax of declaring an ODATA model

var oModel = new


sap.ui.model.odata.v2.ODataModel("http://services.odata.org/Northwind/No
rthwind.svc/");

var oModel = new sap.ui.model.odata.v2.ODataModel({serviceUrl:


"http://services.odata.org/Northwind/Northwind.svc"});

3
JSON Model

It is a client side model


Any changes on the client is not directly reflected back to the
server
Changes should be POSTed back to the server
Syntax of JSON model

var oModel = new


sap.ui.model.json.JSONModel();

oModel.setData({
firstName: "Peter",
lastName: "Pan" oModel.loadData("data.json")
}); ;

4
Resource Model

: i18n for locale-dependant texts,

5
ODATA Signature Methods

create(sPath, oData, mParameters?)Trigger a POST request


to the odata service that was specified in the model
constructor.
read(sPath, mParameters?)Trigger a GET request to the odata
service that was specified in the model constructor.
update(sPath, oData, mParameters?)Trigger a PUT/MERGE
request to the odata service that was specified in the model
constructor.
remove(sPath, mParameters?)Trigger a DELETE request to
the odata service that was specified in the model constructor.

6
Types of Binding

Aggregation Binding
Element Binding
Property Binding

7
Aggregation Binding

Aggregation refers to a cluster of things that have come or


been brought together.
Binding refers to writing of data in SAP UI5
So the combination of both refers to writing data on a cluster of
things

8
Syntax for Aggregation binding on an XML view

9
Syntax for aggregation binding in a controller

10
Element Binding

Element binding allows to bind elements to a specific object in


the model data, which will create a binding context and allow
relative binding within the control and all of its children. This is
especially helpful in master/detail scenarios.

11
Property Binding

Property binding allows properties of the control to get


automatically initialized and updated from model data.
To define a property binding on a control, the following two
options exist:
In the settings object in the constructor of a control
Using the bindProperty method of a control

12
Property Binding

In Settings object of a Control

In Bind Property method of a control

13
Thank You

IT Services
Business Solutions
Consulting

TCS Internal

You might also like