docs

Data Binding

You use data binding to bind UI elements to data sources to keep the data in sync and allow data editing on the UI.


The different data models in UI5 are shown: Resource model, view model, device model, XML model, JSON model, and the
							OData models.

OpenUI5 follows the “Model View Controller” (MVC) paradigm, which means that we clearly separate data sources (model), UI (view), and application logic (controller) from each other. Data binding defines how models and views communicate with each other.

Depending on which external data source you use, you can choose between different model types to represent it. OpenUI5 supports OData V4, OData V2, JSON, and XML models.

There are also internal data sources that are defined in the app for specific purposes. For those, an app contains the following models:

Most of the models are client-side models. This means that all data is initially loaded to the model when the app is started. All actions performed on the data are only executed on the client, and are only sent back to the data source when this is triggered by the app. Client-side models are therefore only recommended for small data sets.

The OData models (V2 and V4) are server-side models, which means that data is provided by a back-end system on demand. Filtering, sorting, and paging actions are performed on the server. This means, for example, that you don’t have to load a complete table on the UI to be able to sort the entries.

In the view, you bind data by specifying the binding path for a control. You can use data types and formatters to validate and format the data on the UI.

Note:

To learn more about data binding, take this tutorial: Data Binding Tutorial.


Binding Modes: One-way Binding, Two-way Binding, and One-time Binding

The binding mode defines how the data sources are bound to the UI. OpenUI5 provides the following binding modes:

The following table shows which binding modes are supported by the respective data models within OpenUI5:

Model One-time One-way Two-way
OData V4 model ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\)
OData V2 model ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif)
ODataMetaModel V4 ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Not supported](/docs/02_Read-Me-First/images/loio5befb5af20ed42fd9052a99014d953a3_LowRes.gif)
ODataMetaModel ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\) ![Not supported](/docs/02_Read-Me-First/images/loio5befb5af20ed42fd9052a99014d953a3_LowRes.gif) ![Not supported](/docs/02_Read-Me-First/images/loio5befb5af20ed42fd9052a99014d953a3_LowRes.gif)
JSON model ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\)
XML model ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\)
Resource model ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) ![Supported](/docs/02_Read-Me-First/images/loio3cb17ee88aed44d2bf1d14b97728c709_LowRes.gif) \(default\) ![Not supported](/docs/02_Read-Me-First/images/loio5befb5af20ed42fd9052a99014d953a3_LowRes.gif)

For more information, see the API Reference: sap.ui.model.BindingMode.