class sap.uxap.BlockBase

Control sample: sap.uxap.BlockBase
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/uxap/BlockBase
Application Component: CA-UI5-CTR

The main element that holds the content that is displayed in an ObjectPageLayout, but not necessarily only there.

Overview

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

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


Properties

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 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.

Visibility: public
showSubSectionMore boolean false

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.

Visibility: public
visible boolean true

Determines the visibility of the block.

Visibility: public

Aggregations

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


Associations

Name Cardinality Type Description
selectedView 0..1 sap.ui.core.Control

The current view. Corresponds to the currently specified mode of the sap.uxap.BlockBase. Can be used as a getter for the internally created view.

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 viewInit event.


Events Overview

Event Description
viewInit

Fired when an aggregated view is instantiated.

Since: 1.72.

viewInit

Fired when an aggregated view is instantiated.

Since: 1.72.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
view sap.ui.core.mvc.View

The initialized view.


Methods Overview

Method Description
addMapping

Adds some mapping to the aggregation mappings.

attachViewInit

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.

createView

Creates a view.

destroyMappings

Destroys all the mappings in the aggregation mappings.

detachViewInit

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.

sap.uxap.BlockBase.extend

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.

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 "auto".

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 BlockColumns.

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 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.

getSelectedView

ID of the element which is the current target of the association selectedView, or null.

getShowSubSectionMore

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.

getVisible

Gets current value of property visible.

Determines the visibility of the block.

Default value is true.

indexOfMapping

Checks for the provided sap.uxap.ModelMapping in the aggregation mappings. and returns its index if found or -1 otherwise.

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 null or undefined, the default value of the property will be restored.

Default value is BlockColumns.

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 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.

setVisible

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.

addMapping

Adds some mapping to the aggregation mappings.

Param Type DefaultValue Description
oMapping sap.uxap.ModelMapping

The mapping to add; if empty, nothing is inserted

attachViewInit

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 sap.uxap.BlockBase itself

createView

Creates a view.

Param Type DefaultValue Description
mParameter object

View metadata

sMode string

Mode associated with the view

destroyMappings

Destroys all the mappings in the aggregation mappings.

detachViewInit

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

sap.uxap.BlockBase.extend

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

fireViewInit

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.

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 "auto".

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 BlockColumns.

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 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.

getSelectedView

ID of the element which is the current target of the association selectedView, or null.

getShowSubSectionMore

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.

getVisible

Gets current value of property visible.

Determines the visibility of the block.

Default value is true.

indexOfMapping

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

insertMapping

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 0-based index the mapping should be inserted at; for a negative value of iIndex, the mapping is inserted at position 0; for a value greater than the current size of the aggregation, the mapping is inserted at the last position

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.

Param Type DefaultValue Description
vMapping int string sap.uxap.ModelMapping

The mapping to remove or its index or id

setColumnLayout

Set the column layout for this particular block.

Param Type DefaultValue Description
sLayout string

The column layout to apply to the control

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 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 formAdjustment

setMode

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)

setSelectedView

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

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 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 showSubSectionMore

setVisible

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 visible