Show TOC

Data BindingLocate this document in the navigation structure

SAPUI5 uses data binding to bind two data sources or information sources together to keep them in synch: All changes in one data source are also reflected in the other data source.

For data binding, you need a model and a data binding instance: The model instance holds the data and provides methods to set the data or to retrieve the data from a server. It also provides a method for creating bindings to the data. When this method is called, a data binding instance is created, which contains the binding information and provides an event, which is fired whenever the bound data is changed. An element can listen to this event and update its visualization according to the new data.

The UI usually uses data binding to bind UI controls to the model, which holds the application data, so that the controls are updated automatically whenever application data is changed. The data binding is also used when changes in the control cause updates in the underlying application data, such as data being entered by a user. This is called two-way binding.

The default binding mode for model implementations (if not implemented otherwise) is two-way binding and the supported binding modes by the model are one-way binding, two-way binding and one-time binding. The default binding mode can be changed by the application for each model instance. A model implementation should specify its supported binding modes and set the default binding mode accordingly (e.g. if the model supports only one way binding the default binding mode should also be set to one way).