The main element that holds the content that is displayed in an ObjectPageLayout, but not necessarily only there.
The blocks give the flexibility to combine different content types.
A block is a control that:
As any UI5 view, the XML view can have a controller which automatically comes with a this.oParentBlock
attribute (so that the controller can interact with the block). The oParentBlock
is firstly available in onParentBlockModeChange
method. If the controller implements the onParentBlockModeChange
method, this method will be called with the sMode
parameter when the view is used or reused by the block.
Documentation links:
Constructor for a new BlockBase
.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.uxap.BlockBase(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new control, generated automatically if no ID is given |
|
mSettings? | object | Initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
columnLayout | sap.uxap.BlockBaseColumnLayout | auto | Determines on how many columns the layout will be rendered. Allowed values are integers from 1 to 4 and "auto". Visibility: public |
formAdjustment | sap.uxap.BlockBaseFormAdjustment | BlockColumns | Determines if the block should automatically adjust its inner forms. Allowed values are "BlockColumns" and "OneColumn" and "None". If the value is "BlockColumns", then the inner form will have as many columns as the colspan of its parent block. If the value is "OneColumn", the inner form will have exactly one column, regardless the colspan of its parent block. If the value is "None", no automatic adjustment of inner forms will be made and the form will keep its original column count. Visibility: public |
mode | string | Determines the mode of the block. See ObjectPageSubSectionMode. When |
|
showSubSectionMore | boolean | false | Determines whether the show more button should be shown. Note: The property will take effect if the |
visible | boolean | true | Determines the visibility of the block. Visibility: public |
Default Aggregation: mappings
Name | Cardinality | Type | Description |
---|---|---|---|
_views | 0..n | sap.ui.core.Control |
Internal aggregation that contains all views inside this Block |
mappings (default) | 0..n | sap.uxap.ModelMapping |
Map external UI5 model and internal Block model |
Name | Cardinality | Type | Description |
---|---|---|---|
selectedView | 0..1 | sap.ui.core.Control |
The current view. Corresponds to the currently specified Note: As the views are created asynchronously, this association will be updated only after the view creation is completed. Applications that want to be notified when a view is created should subscribe to the |
Event | Description |
---|---|
viewInit |
Fired when an aggregated view is instantiated. |
Method | Description |
---|---|
addMapping |
Adds some mapping to the aggregation mappings. |
attachViewInit |
Attaches event handler When called, the context of the event handler (its Fired when an aggregated view is instantiated. |
createView |
Creates a view. |
destroyMappings |
Destroys all the mappings in the aggregation mappings. |
detachViewInit |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.uxap.BlockBase.extend |
Creates a new subclass of class sap.uxap.BlockBase with name
|
fireViewInit |
Fires event viewInit to attached listeners. |
getColumnLayout |
Gets current value of property columnLayout. Determines on how many columns the layout will be rendered. Allowed values are integers from 1 to 4 and "auto". Default value is |
getFormAdjustment |
Gets current value of property formAdjustment. Determines if the block should automatically adjust its inner forms. Allowed values are "BlockColumns" and "OneColumn" and "None". If the value is "BlockColumns", then the inner form will have as many columns as the colspan of its parent block. If the value is "OneColumn", the inner form will have exactly one column, regardless the colspan of its parent block. If the value is "None", no automatic adjustment of inner forms will be made and the form will keep its original column count. Default value is |
getMappings |
Gets content of aggregation mappings. Map external UI5 model and internal Block model |
sap.uxap.BlockBase.getMetadata |
Returns a metadata object for class sap.uxap.BlockBase. |
getMode |
Gets current value of property mode. Determines the mode of the block. See ObjectPageSubSectionMode. When |
getSelectedView |
ID of the element which is the current target of the association selectedView, or |
getShowSubSectionMore |
Gets current value of property showSubSectionMore. Determines whether the show more button should be shown. Note: The property will take effect if the Default value is |
getVisible |
Gets current value of property visible. Determines the visibility of the block. Default value is |
indexOfMapping |
Checks for the provided |
insertMapping |
Inserts a mapping into the aggregation mappings. |
removeAllMappings |
Removes all the controls from the aggregation mappings. Additionally, it unregisters them from the hosting UIArea. |
removeMapping |
Removes a mapping from the aggregation mappings. |
setColumnLayout |
Set the column layout for this particular block. |
setFormAdjustment |
Sets a new value for property formAdjustment. Determines if the block should automatically adjust its inner forms. Allowed values are "BlockColumns" and "OneColumn" and "None". If the value is "BlockColumns", then the inner form will have as many columns as the colspan of its parent block. If the value is "OneColumn", the inner form will have exactly one column, regardless the colspan of its parent block. If the value is "None", no automatic adjustment of inner forms will be made and the form will keep its original column count. When called with a value of Default value is |
setMode |
Set the view mode for this particular block. |
setSelectedView |
Sets the associated selectedView. |
setShowSubSectionMore |
Sets a new value for property showSubSectionMore. Determines whether the show more button should be shown. Note: The property will take effect if the When called with a value of Default value is |
setVisible |
Sets a new value for property visible. Determines the visibility of the block. When called with a value of Default value is |
Adds some mapping to the aggregation mappings.
Param | Type | DefaultValue | Description |
---|---|---|---|
oMapping | sap.uxap.ModelMapping |
The mapping to add; if empty, nothing is inserted |
Attaches event handler fnFunction
to the viewInit event of this sap.uxap.BlockBase
.
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.uxap.BlockBase
itself.
Fired when an aggregated view is instantiated.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Creates a view.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameter | object |
View metadata |
|
sMode | string |
Mode associated with the view |
Detaches event handler fnFunction
from the viewInit event of this sap.uxap.BlockBase
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.uxap.BlockBase 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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event viewInit to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
view | sap.ui.core.mvc.View |
The initialized view. |
Gets current value of property columnLayout.
Determines on how many columns the layout will be rendered. Allowed values are integers from 1 to 4 and "auto".
Default value is "auto"
.
Gets current value of property formAdjustment.
Determines if the block should automatically adjust its inner forms. Allowed values are "BlockColumns" and "OneColumn" and "None". If the value is "BlockColumns", then the inner form will have as many columns as the colspan of its parent block. If the value is "OneColumn", the inner form will have exactly one column, regardless the colspan of its parent block. If the value is "None", no automatic adjustment of inner forms will be made and the form will keep its original column count.
Default value is BlockColumns
.
Gets current value of property mode.
Determines the mode of the block. See ObjectPageSubSectionMode. When BlockBase
is used inside an ObjectPageLayout
, the mode
property is inherited from the respective SubSection. The mode
property of BlockBase
changes when the mode
property of ObjectPageSubSection
changes.
ID of the element which is the current target of the association selectedView, or null
.
Gets current value of property showSubSectionMore.
Determines whether the show more button should be shown.
Note: The property will take effect if the BlockBase
is inside ObjectPageSubSection
and would be ignored in case the BlockBase
is nested inside another BlockBase
.
Default value is false
.
Gets current value of property visible.
Determines the visibility of the block.
Default value is true
.
Checks for the provided sap.uxap.ModelMapping
in the aggregation mappings. and returns its index if found or -1 otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oMapping | sap.uxap.ModelMapping |
The mapping whose index is looked for |
Inserts a mapping into the aggregation mappings.
Param | Type | DefaultValue | Description |
---|---|---|---|
oMapping | sap.uxap.ModelMapping |
The mapping to insert; if empty, nothing is inserted |
|
iIndex | int |
The |
Removes all the controls from the aggregation mappings.
Additionally, it unregisters them from the hosting UIArea.
Removes a mapping from the aggregation mappings.
Param | Type | DefaultValue | Description |
---|---|---|---|
vMapping | int string sap.uxap.ModelMapping |
The mapping to remove or its index or id |
Set the column layout for this particular block.
Param | Type | DefaultValue | Description |
---|---|---|---|
sLayout | string |
The column layout to apply to the control |
Sets a new value for property formAdjustment.
Determines if the block should automatically adjust its inner forms. Allowed values are "BlockColumns" and "OneColumn" and "None". If the value is "BlockColumns", then the inner form will have as many columns as the colspan of its parent block. If the value is "OneColumn", the inner form will have exactly one column, regardless the colspan of its parent block. If the value is "None", no automatic adjustment of inner forms will be made and the form will keep its original column count.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is BlockColumns
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sFormAdjustment | sap.uxap.BlockBaseFormAdjustment | BlockColumns |
New value for property |
Set the view mode for this particular block.
Param | Type | DefaultValue | Description |
---|---|---|---|
sMode | string |
the mode to apply to the control (that should be synchronized with view declared) |
Sets the associated selectedView.
Param | Type | DefaultValue | Description |
---|---|---|---|
oSelectedView | sap.ui.core.ID sap.ui.core.Control |
ID of an element which becomes the new target of this selectedView association; alternatively, an element instance may be given |
Sets a new value for property showSubSectionMore.
Determines whether the show more button should be shown.
Note: The property will take effect if the BlockBase
is inside ObjectPageSubSection
and would be ignored in case the BlockBase
is nested inside another BlockBase
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowSubSectionMore | boolean | false |
New value for property |
Sets a new value for property visible.
Determines the visibility of the block.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bVisible | boolean | true |
New value for property |