Data Binding Using Index and Key
For Dropdown listboxes and RadioButtonGroups there are different ways of data binding: data binding using an index (index binding) and data binding using a key (key binding). The names of the UI elements indicate the respective data binding variant.
· Index Binding
· Key Binding
Index binding is based on multiple nodes. The texts property is bound to an attribute within a context node, which contains several elements (cardinality = 0..n). The number of elements defines the possible entries in the list, and the lead selection defines the selected element; for example, with a RadioButtonGroupByIndex one radio button is displayed for each element. The selected radio button is specified by the lead selection of the context node. If the user selects a different element, the lead selection changes accordingly. It is possible to bind this element in a table. Each instance can then contain a different selected set.
When you toggle the selection, the lead selection is changed. If a singleton node is contained in the selection, it will be invalidated.
For examples, refer to the system in the Web Dynpro component WDR_TEST_EVENTS in the views DropDownByIdx and RadiobtngrpByIdx.
With this kind of binding, the values are determined using attribute information in the node information. If the attribute type is a type from the ABAP Dictionary, then the texts are automatically retrieved from the Dictionary, which means that the respective domain values are retrieved from the Dictionary for the display. This is the default.
is also possible to determine the value set yourself and to build the list
dynamically (see also Fixed Values of
If the data type already has a value set, all you can do is restrict this set.
The value of the attribute is the key from the attribute info. The related text (value) is displayed. The value of the attribute changes by selection. Keys and texts (values) are specified for the value set so that the displayed value does not have to correspond to the value in the context (important for translatability). The structure of the value set thus is predefined as a collection of key-value pairs. In contrast to index binding, the UI elements bind against a context attribute and not against an attribute of a multiple node.
Example for data binding where the property of a UI element, which is to display the content, is bound against the attribute.
With a RadioButtonGroupByKey the property selectedKey is bound to a context attribute that has a value set, for example, domain values from the ABAP Dictionary. With a RadioButtonGroupByKey one radio button is displayed for every single key. If a radio button is selected, then the related value is returned to the context attribute.
For examples, refer to the system in the Web Dynpro component WDR_TEST_EVENTS in the views DropDownByKey and RadiobtngrpByKey.
In contrast to index binding, where always different texts are listed in a table column, with this kind of data binding also identical texts can appear in the column.