Class sap.ui.comp.smartform.SmartFormModule: sap/ui/comp/smartform/SmartForm

extends Control

The SmartForm control renders a form (sap.ui.layout.form.Form) and supports key user personalization, such as adding/hiding fields and groups, changing the order of fields and groups, and changing labels. When used with the SmartField control the label is taken from the metadata annotation sap:label if not specified in the XML view.

Constructor Summary
new sap.ui.comp.smartform.SmartForm(sId?, mSettings?)Constructor for a new smartform/SmartForm.
Event Summary
checked(oControlEvent)This event is fired after check was performed.
editToggled(oControlEvent)This event is fired when the editable property is toggled.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.comp.smartform.SmartForm.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.comp.smartform.SmartForm with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.comp.smartform.SmartForm.getMetadata()Returns a metadata object for class sap.ui.comp.smartform.SmartForm.
_updateClonedElements(The)Updates controls in the hierarchy of a cloned smart form.
addAggregation(Name, The)Adds some entity oObject to the aggregation identified by sAggregationName.
addGroup(Group)Adds a group to the aggregation named groups.
attachChecked(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the checked event of this sap.ui.comp.smartform.SmartForm.
attachEditToggled(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the editToggled event of this sap.ui.comp.smartform.SmartForm.
check(Determines)Checks smart fields for client errors.
clone(sIdSuffix?, aLocalIds?)Clones the SmartForm control.
destroyCustomToolbar()Destroys the customToolbar in the aggregation customToolbar.
destroyGroups()Destroys a group from the aggregation named groups.
destroyLayout()Destroys the layout in the aggregation layout.
destroySemanticObjectController()Destroys the semanticObjectController in the aggregation semanticObjectController.
detachChecked(fnFunction, oListener)Detaches event handler fnFunction from the checked event of this sap.ui.comp.smartform.SmartForm.
detachEditToggled(fnFunction, oListener)Detaches event handler fnFunction from the editToggled event of this sap.ui.comp.smartform.SmartForm.
exit()Cleans up the resources associated with this element and all its children.
fireChecked(mArguments?)Fires event checked to attached listeners.
fireEditToggled(mArguments?)Fires event editToggled to attached listeners.
getAggregation(Name)Returns the aggregated object(s) for the named aggregation.
getCheckButton()Gets current value of property checkButton.
getCustomToolbar()Getter for aggregation customToolbar.
getEditable()Gets current value of property editable.
getEditTogglable()Gets current value of property editTogglable.
getEntityType()Gets current value of property entityType.
getExpandable()Gets current value of property expandable.
getExpanded()Gets current value of property expanded.
getFlexEnabled()Gets current value of property flexEnabled.
getGroups()Returns the content of aggregation groups.
getHorizontalLayoutGroupElementMinWidth()Gets current value of property horizontalLayoutGroupElementMinWidth.
getIgnoredFields()Gets current value of property ignoredFields.
getLayout()Gets content of aggregation layout.
getSemanticObjectController()Gets content of aggregation semanticObjectController.
getSmartFields(Determines)Retrieves all the smart fields of the form.
getTitle()Gets current value of property title.
getUseHorizontalLayout()Gets current value of property useHorizontalLayout.
getVisibleProperties()Returns the array of properties currently visible on the UI.
indexOfGroup(oGroup)Checks for the provided sap.ui.comp.smartform.Group in the aggregation groups.
insertGroup(The, The)Inserts a group into the aggregation named groups.
propagateGridDataSpan()Sets default span for GridData layout of group elements when used with horizontal layout.
removeAllGroups()Removes all the groups in the aggregation named groups.
removeGroup(The)Removes a group from the aggregation named groups.
setCheckButton(bCheckButton)Sets a new value for property checkButton.
setCustomToolbar(New)Setter for aggregation customToolbar.
setEditable(bEditable)Setter for property editable.
setEditTogglable(New)Setter for property editTogglable.
setEntityType(sEntityType)Sets a new value for property entityType.
setExpandable(bExpandable)Sets a new value for property expandable.
setExpanded(bExpanded)Sets a new value for property expanded.
setFlexEnabled(bFlexEnabled)Sets a new value for property flexEnabled.
setFocusOnEditableControl()Sets the focus on the first editable control.
setHorizontalLayoutGroupElementMinWidth(New)Setter for property horizontalLayoutGroupElementMinWidth.
setIgnoredFields(sIgnoredFields)Sets a new value for property ignoredFields.
setLayout(oLayout)Sets the aggregated layout.
setSemanticObjectController(oSemanticObjectController)Sets the aggregated semanticObjectController.
setTitle(sTitle)Setter for property title.
setUseHorizontalLayout(New)Setter for property useHorizontalLayout.
Constructor Detail
new sap.ui.comp.smartform.SmartForm(sId?, mSettings?)
Constructor for a new smartform/SmartForm.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Event Detail
checked(oControlEvent)
This event is fired after check was performed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
editToggled(oControlEvent)
This event is fired when the editable property is toggled.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Method Detail
sap.ui.comp.smartform.SmartForm.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.comp.smartform.SmartForm with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.comp.smartform.SmartForm.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.comp.smartform.SmartForm.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
_updateClonedElements(The)
Updates controls in the hierarchy of a cloned smart form.
Parameters:
{sap.ui.comp.smartform.SmartForm}The cloned smart form
addAggregation(Name, The)
Adds some entity oObject to the aggregation identified by sAggregationName.
Parameters:
{string}Name of the aggregation
{object}The object representing a group
addGroup(Group)
Adds a group to the aggregation named groups.
Parameters:
{object}Group to be added
attachChecked(oData?, fnFunction, oListener?): sap.ui.comp.smartform.SmartForm
Attaches event handler fnFunction to the checked event of this sap.ui.comp.smartform.SmartForm.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.comp.smartform.SmartForm itself.

This event is fired after check was performed.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.smartform.SmartForm itself
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
attachEditToggled(oData?, fnFunction, oListener?): sap.ui.comp.smartform.SmartForm
Attaches event handler fnFunction to the editToggled event of this sap.ui.comp.smartform.SmartForm.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.comp.smartform.SmartForm itself.

This event is fired when the editable property is toggled.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.smartform.SmartForm itself
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
check(Determines): string[]
Checks smart fields for client errors.
Parameters:
{boolean}Determines is only visible fields in visible groups should be considered. default: true
Returns:
{string[]} An array of fields with errors
clone(sIdSuffix?, aLocalIds?): sap.ui.base.ManagedObject
Clones the SmartForm control.
Parameters:
{string}sIdSuffix? A suffix to be appended to the cloned element id
{string[]}aLocalIds? An array of local IDs within the cloned hierarchy (internally used)
Returns:
{sap.ui.base.ManagedObject} A reference to the newly created clone
destroyCustomToolbar(): sap.ui.comp.smartform.SmartForm
Destroys the customToolbar in the aggregation customToolbar.
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
Destroys a group from the aggregation named groups.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
Destroys the layout in the aggregation layout.
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
destroySemanticObjectController(): sap.ui.comp.smartform.SmartForm
Destroys the semanticObjectController in the aggregation semanticObjectController.
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
detachChecked(fnFunction, oListener): sap.ui.comp.smartform.SmartForm
Detaches event handler fnFunction from the checked event of this sap.ui.comp.smartform.SmartForm.

The passed function and listener object must match the ones used for event registration.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
detachEditToggled(fnFunction, oListener): sap.ui.comp.smartform.SmartForm
Detaches event handler fnFunction from the editToggled event of this sap.ui.comp.smartform.SmartForm.

The passed function and listener object must match the ones used for event registration.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
exit()
Cleans up the resources associated with this element and all its children.
fireChecked(mArguments?): sap.ui.comp.smartform.SmartForm
Fires event checked to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
fireEditToggled(mArguments?): sap.ui.comp.smartform.SmartForm
Fires event editToggled to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
getAggregation(Name): array
Returns the aggregated object(s) for the named aggregation.
Parameters:
{string}Name of the aggregation
Returns:
{array} Content of an aggregation
getCheckButton(): boolean
Gets current value of property checkButton.

Specifies whether a check button is added to the toolbar.

Default value is false.

Returns:
{boolean} Value of property checkButton
getCustomToolbar(): sap.m.Toolbar
Getter for aggregation customToolbar.
Returns:
{sap.m.Toolbar} The custom toolbar
getEditable(): boolean
Gets current value of property editable.

Specifies whether the form is editable.

Default value is false.

Returns:
{boolean} Value of property editable
getEditTogglable(): boolean
Gets current value of property editTogglable.

Specifies whether the editable property is togglable via button.

Default value is false.

Returns:
{boolean} Value of property editTogglable
getEntityType(): string
Gets current value of property entityType.

CSV of entity types for which the flexibility features are available.
For more information about SAPUI5 flexibility, refer to the Developer Guide.
Note:
No validation is done. Please ensure that you do not add spaces or special characters.

Returns:
{string} Value of property entityType
getExpandable(): boolean
Gets current value of property expandable.

Specifies whether the control is expandable. Per default the control is not rendered as expanded.

Default value is false.

Returns:
{boolean} Value of property expandable
getExpanded(): boolean
Gets current value of property expanded.

If expandable, this property indicates whether the state is expanded or not. If expanded, then the toolbar (if available) and the content is rendered; if expanded is false, then only the headerText/headerToolbar is rendered.

Returns:
{boolean} Value of property expanded
getFlexEnabled(): boolean
Gets current value of property flexEnabled.

Specifies whether the form enables flexibility features, such as adding new fields.
For more information about SAPUI5 flexibility, refer to the Developer Guide.

Default value is true.

Returns:
{boolean} Value of property flexEnabled
getGroups(): array
Returns the content of aggregation groups.
Returns:
{array} of groups
getHorizontalLayoutGroupElementMinWidth(): int
Gets current value of property horizontalLayoutGroupElementMinWidth.

Specifies the minimal size in pixels of all group elements of the form if the horizontal layout is used.

Returns:
{int} Value of property horizontalLayoutGroupElementMinWidth
getIgnoredFields(): string
Gets current value of property ignoredFields.

CSV of fields that must be ignored in the OData metadata by the SmartForm control.
Note:
No validation is done. Please ensure that you do not add spaces or special characters.

Returns:
{string} Value of property ignoredFields
Gets content of aggregation layout.

Layout settings to adjust ResponsiveGridLayout

Returns:
{sap.ui.comp.smartform.Layout}
getSemanticObjectController(): sap.ui.comp.navpopover.SemanticObjectController
Gets content of aggregation semanticObjectController.

The Semantic Object Controller allows the user to specify and overwrite functionality for semantic object navigation.

Returns:
{sap.ui.comp.navpopover.SemanticObjectController}
getSmartFields(Determines): sap.ui.comp.smartfield.SmartField[]
Retrieves all the smart fields of the form.
Parameters:
{boolean}Determines if only visible groups are considered; default is true
Returns:
{sap.ui.comp.smartfield.SmartField[]} An array of smart fields (might be empty).
getTitle(): string
Gets current value of property title.

Title of the form.

Returns:
{string} Value of property title
getUseHorizontalLayout(): boolean
Gets current value of property useHorizontalLayout.

Specifies whether the groups are rendered in a ResponsiveLayout with the label above the field. Each group is rendered in a new line.

Returns:
{boolean} Value of property useHorizontalLayout
getVisibleProperties(): string[]
Returns the array of properties currently visible on the UI.
Returns:
{string[]} The properties currently visible
indexOfGroup(oGroup): int
Checks for the provided sap.ui.comp.smartform.Group in the aggregation groups. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.comp.smartform.Group}oGroup The group whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertGroup(The, The): sap.ui.comp.smartform.SmartForm
Inserts a group into the aggregation named groups.
Parameters:
{sap.ui.comp.smartform.Group}The group to insert
{int}The 0-based index the group should be inserted at
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
propagateGridDataSpan(): sap.ui.comp.smartform.SmartForm
Sets default span for GridData layout of group elements when used with horizontal layout.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
removeAllGroups(): sap.ui.comp.smartform.Group[]
Removes all the groups in the aggregation named groups.
Returns:
{sap.ui.comp.smartform.Group[]} an array of the removed groups (might be empty).
Removes a group from the aggregation named groups.
Parameters:
{sap.ui.comp.smartform.Group}The group to be removed
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
setCheckButton(bCheckButton): sap.ui.comp.smartform.SmartForm
Sets a new value for property checkButton.

Specifies whether a check button is added to the toolbar.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bCheckButton New value for property checkButton
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setCustomToolbar(New): sap.ui.comp.smartform.SmartForm
Setter for aggregation customToolbar. Default value is undefined.
Parameters:
{sap.m.Toolbar}New value for aggregation customToolbar.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
setEditable(bEditable): sap.ui.comp.smartform.SmartForm
Setter for property editable.
Parameters:
{boolean}bEditable New value for property editable.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
setEditTogglable(New): sap.ui.comp.smartform.SmartForm
Setter for property editTogglable. Default value is undefined.
Parameters:
{boolean}New value for property editTogglable.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
setEntityType(sEntityType): sap.ui.comp.smartform.SmartForm
Sets a new value for property entityType.

CSV of entity types for which the flexibility features are available.
For more information about SAPUI5 flexibility, refer to the Developer Guide.
Note:
No validation is done. Please ensure that you do not add spaces or special characters.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{string}sEntityType New value for property entityType
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setExpandable(bExpandable): sap.ui.comp.smartform.SmartForm
Sets a new value for property expandable.

Specifies whether the control is expandable. Per default the control is not rendered as expanded.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bExpandable New value for property expandable
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setExpanded(bExpanded): sap.ui.comp.smartform.SmartForm
Sets a new value for property expanded.

If expandable, this property indicates whether the state is expanded or not. If expanded, then the toolbar (if available) and the content is rendered; if expanded is false, then only the headerText/headerToolbar is rendered.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{boolean}bExpanded New value for property expanded
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setFlexEnabled(bFlexEnabled): sap.ui.comp.smartform.SmartForm
Sets a new value for property flexEnabled.

Specifies whether the form enables flexibility features, such as adding new fields.
For more information about SAPUI5 flexibility, refer to the Developer Guide.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Parameters:
{boolean}bFlexEnabled New value for property flexEnabled
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setFocusOnEditableControl()
Sets the focus on the first editable control.
Since:
1.36.0
setHorizontalLayoutGroupElementMinWidth(New)
Setter for property horizontalLayoutGroupElementMinWidth.
Parameters:
{int}New value for property horizontalLayoutGroupElementMinWidth.
setIgnoredFields(sIgnoredFields): sap.ui.comp.smartform.SmartForm
Sets a new value for property ignoredFields.

CSV of fields that must be ignored in the OData metadata by the SmartForm control.
Note:
No validation is done. Please ensure that you do not add spaces or special characters.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{string}sIgnoredFields New value for property ignoredFields
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setLayout(oLayout): sap.ui.comp.smartform.SmartForm
Sets the aggregated layout.
Parameters:
{sap.ui.comp.smartform.Layout}oLayout The layout to set
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
setSemanticObjectController(oSemanticObjectController): sap.ui.comp.smartform.SmartForm
Sets the aggregated semanticObjectController.
Parameters:
{sap.ui.comp.navpopover.SemanticObjectController}oSemanticObjectController The semanticObjectController to set
Returns:
{sap.ui.comp.smartform.SmartForm} Reference to this in order to allow method chaining
Setter for property title. Default value is undefined.
Parameters:
{string}sTitle new value for property title.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.
setUseHorizontalLayout(New): sap.ui.comp.smartform.SmartForm
Setter for property useHorizontalLayout.
Parameters:
{boolean}New value for property useHorizontalLayout.
Returns:
{sap.ui.comp.smartform.SmartForm}this to allow method chaining.