Show TOC Start of Content Area

Background documentation Data Binding  Locate the document in its SAP Library structure

All user interface (UI) elements have a set of properties. For instance, the InputField UI element has properties such as value, password, and readOnly. By setting the value of these properties, you can modify both the appearance and behavior of the UI element. There are several ways to set a UI element property. The most common are:

      hard-coding the value of the property

      binding the property to a suitable attribute in the context

Recommendation

SAP strongly recommends to bind UI element properties to the context.

Binding the UI element properties to attributes of a view context enables the context data to be displayed in the browser. Any user changes to the view displayed in the browser are stored in the context. Multiple properties can be bound to one context element.

Within a context, all elementary data types are available for the definition of attributes. By creating a dedicated context attribute of the correct data type, you can programmatically control the appearance and the behavior of a UI element that is to be displayed on the screen.

Example

To control whether an InputField UI element is input ready, the readOnly property is to be set. To do this by data binding, you first create a context attribute of data type boolean. As a second step you create the inputField UI element in a view layout of your component. In the Properties list of  the UI element, you assign the readOnly property to the context attribute.

Now at runtime, the input field will only be open for input if the corresponding context boolean attribute is set to false.

More Information

Data Binding

End of Content Area