Blog

What Is Data Bındıng ın SAPUI5?

Data binding is the process that establishes a connection between the user interface and the business logic. It acts as a bridge between the binding target and the binding source.​

What Are the Binding Methods?

There are basically three different binding methods in SAPUI5:​

  • One-way binding: This means binding from the model to the view; any changes made on the front end do not affect the model, and all data changes are only reflected in the controls.​
  • Two-way binding: This means binding from the model to the view and from the view to the model; all changes made on the front end are reflected in the model and the database, and changes made in the model and view update all bindings, the view, and the model, respectively.​
  • One-time binding: This means one-time binding from the model to the view. After a one-time connection, no further binding is established.
Data Binding in SAPUI5 -1

The table below shows which models support the binding types mentioned above.​

What Are the Types of Data Binding?

1.Element Binding

For example, consider the following data.

Data Binding in SAPUI5 -2

Now, in the UI code, we have a layout that will display the above data. During data binding, we don't need to specify the full path for child controls as shown below.​

Data Binding in SAPUI5 -3

Thus, element binding allows relative binding of all children according to a parent.​

2.Property Binding

This is simply binding between the control and the model. It allows for automatic initialization and updating of data.

Data Binding in SAPUI5 -4

We use the value property to bind data to the input field, and we can access it by providing the path of the model to be bound.

3.Aggregation Binding 

If we want to display our data in a table or list format, we can use aggregation binding.

Data Binding in SAPUI5 -5

In this example, we use the <items> property of the List control to bind data, but the StandardListItem control works as a template.​

4.Expression Binding

 If we need some calculation or some kind of comparison on our model data, it is useful to use expression binding. For example, we can update the numberState property as follows:

Models and data binding are used in SAPUI5 applications to bind two data or information sources and synchronize data. SAPUI5 applications support different types of models. Since the JSON model provides much better performance compared to XML models, its usage is more preferred.​

SAP Consulting Services


Similar
Blog

Your mail has been sent successfully. You will be contacted as soon as possible.

Your message could not be delivered! Please try again later.