The sap.ui.comp.smartfield.SmartField control offers a wrapper for other controls using OData metadata to determine which control has to be instantiated and makes it possible to add input-enabled fields to an application.
Hosting controls for editing and displaying values of OData properties
Providing value help automatically
Performing input checks
In addition, the SmartField control implements field control and supports message handling.
The SmartField control can be used in the following ways:
As a standalone control, for example, in XML views
In combination with a SmartForm control
In combination with a SmartTable control
Used in particular as cell editor in editing scenarios.
The SmartField control selects a control for displaying and a control for editing the OData property to which they are bound. The main criterion for selecting nested controls is the EDM type of the OData property to which a SmartField control is bound.
The OData property that a SmartField control manages is determined by the binding of the value property of the control. Here arbitrarily and deeply nested, complex properties are supported.
The SmartField control allows for binding of navigation properties.
The entity set to which the bindings are related is either specified in the entitySet attribute of the control or deduced from the binding context at runtime.
You can use any available predefined model for data binding in the SmartField control.
EDM Type |
Control |
---|---|
Edm.Boolean |
sap.m.CheckBox |
Edm.Int16 |
sap.m.Input |
Edm.Int32 |
|
Edm.Int64 |
|
Edm.SByte |
|
Edm.Byte |
|
Edm.Single |
|
Edm.Float |
|
Edm.Double |
|
Edm.Decimal |
|
Edm.DateTime |
|
Edm.DateTimeOffset |
|
Edm.String |
The SmartField control supports several annotations:
Value list annotation
The annotation determines whether a value help dialog and the type ahead function are available.If the entitySet that is addressed in the value list annotation has in turn the sap:semantics annotation with value fixed-values, a combo box is rendered.
The annotation is used to determine, for example, whether the SmartField control manages currencies.
Semantic object annotation
The annotation is used to determine whether the SmartField control must manage a SmartLink control.
The SmartField control provides the option to overwrite the default behavior for control selection by using a specific configuration.
You have the following options:
If the relevant OData property is of type Edm.String or Edm.Boolean, the SmartField control can be configured to render a combo box.
In addition, the display format of the date in the date picker can also be configured.
EDM Type |
Control |
---|---|
Edm.Boolean |
sap.m.CheckBox |
Edm.Int16 |
sap.m.Text |
Edm.Int32 |
|
Edm.Int64 |
|
Edm.SByte |
|
Edm.Byte |
|
Edm.Single |
|
Edm.Float |
|
Edm.Double |
|
Edm.Decimal |
|
Edm.DateTime |
|
Edm.DateTimeOffset |
|
Edm.String |
The field control handles the visual representation of SmartField controls, such as:
Whether input is mandatory
Whether the controls are read-only
Whether the controls are hidden as defined by the SAP Fiori user interface programming model
The following attributes are available to implement field control:
Enabled
Toggles from display to edit mode.
Hides the SmartField control.
Determines whether input is required.
Consumers of the SmartField control can further adapt the runtime behavior by binding these attributes.
The behavior can only be made more restrictive on client side, for example, if an OData property is mandatory, this cannot be overwritten on SmartField control level.