class sap.m.ScrollContainer

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

The ScrollContainer is a control that can display arbitrary content within a limited screen area and provides scrolling to make all content accessible.

When not to use

Do not nest scrolling areas that scroll in the same direction (e.g. a ScrollContainer that scrolls vertically inside a Page control with scrolling enabled).

This control can be a drop target.

Constructor

Constructor for a new ScrollContainer.

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.m.ScrollContainer(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
focusable boolean false

Whether the scroll container can be focused.

Note that it should be set to "true" when there are no focusable elements inside or when keyboard interaction requires an additional tab stop on the container.

Visibility: public
height sap.ui.core.CSSSize auto

The height of the ScrollContainer. By default the height equals the content height. If only horizontal scrolling is used, do not set the height or make sure the height is always larger than the height of the content.

Note that when a percentage is given, for the height to work as expected, the height of the surrounding container must be defined.

Visibility: public
horizontal boolean true

Whether horizontal scrolling should be possible.

Visibility: public
vertical boolean false

Whether vertical scrolling should be possible.

Note that this is off by default because typically a Page is used as fullscreen element which can handle vertical scrolling. If this is not the case and vertical scrolling is required, this flag needs to be set to "true". Important: it is not supported to have nested controls that both enable scrolling into the same dimension.

Visibility: public
width sap.ui.core.CSSSize auto

The width of the ScrollContainer. If not set, it consumes the complete available width, behaving like normal HTML block elements. If only vertical scrolling is enabled, make sure the content always fits or wraps.

Visibility: public

Aggregations

Default Aggregation: content

Name Cardinality Type Description
content (default) 0..n sap.ui.core.Control

The content of the ScrollContainer.


Methods Overview

Method Description
addContent

Adds some content to the aggregation content.

destroyContent

Destroys all the content in the aggregation content.

sap.m.ScrollContainer.extend

Creates a new subclass of class sap.m.ScrollContainer 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.

getContent

Gets content of aggregation content.

The content of the ScrollContainer.

getFocusable

Gets current value of property focusable.

Whether the scroll container can be focused.

Note that it should be set to "true" when there are no focusable elements inside or when keyboard interaction requires an additional tab stop on the container.

Default value is false.

getHeight

Gets current value of property height.

The height of the ScrollContainer. By default the height equals the content height. If only horizontal scrolling is used, do not set the height or make sure the height is always larger than the height of the content.

Note that when a percentage is given, for the height to work as expected, the height of the surrounding container must be defined.

Default value is 'auto'.

getHorizontal

Gets current value of property horizontal.

Whether horizontal scrolling should be possible.

Default value is true.

sap.m.ScrollContainer.getMetadata

Returns a metadata object for class sap.m.ScrollContainer.

getVertical

Gets current value of property vertical.

Whether vertical scrolling should be possible.

Note that this is off by default because typically a Page is used as fullscreen element which can handle vertical scrolling. If this is not the case and vertical scrolling is required, this flag needs to be set to "true". Important: it is not supported to have nested controls that both enable scrolling into the same dimension.

Default value is false.

getWidth

Gets current value of property width.

The width of the ScrollContainer. If not set, it consumes the complete available width, behaving like normal HTML block elements. If only vertical scrolling is enabled, make sure the content always fits or wraps.

Default value is 'auto'.

indexOfContent

Checks for the provided sap.ui.core.Control in the aggregation content. and returns its index if found or -1 otherwise.

insertContent

Inserts a content into the aggregation content.

removeAllContent

Removes all the controls from the aggregation content.

Additionally, it unregisters them from the hosting UIArea.

removeContent

Removes a content from the aggregation content.

scrollTo

Scrolls to the given position. When called while the control is not rendered (yet), the scrolling position is still applied, but there is no animation.

scrollToElement

Scrolls to an element(DOM or sap.ui.core.Element) within the page if the element is rendered.

setFocusable

Sets a new value for property focusable.

Whether the scroll container can be focused.

Note that it should be set to "true" when there are no focusable elements inside or when keyboard interaction requires an additional tab stop on the container.

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

Default value is false.

setHeight

Sets a new value for property height.

The height of the ScrollContainer. By default the height equals the content height. If only horizontal scrolling is used, do not set the height or make sure the height is always larger than the height of the content.

Note that when a percentage is given, for the height to work as expected, the height of the surrounding container must be defined.

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

Default value is 'auto'.

setHorizontal

Sets a new value for property horizontal.

Whether horizontal scrolling should be possible.

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

Default value is true.

setVertical

Sets a new value for property vertical.

Whether vertical scrolling should be possible.

Note that this is off by default because typically a Page is used as fullscreen element which can handle vertical scrolling. If this is not the case and vertical scrolling is required, this flag needs to be set to "true". Important: it is not supported to have nested controls that both enable scrolling into the same dimension.

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

Default value is false.

setWidth

Sets a new value for property width.

The width of the ScrollContainer. If not set, it consumes the complete available width, behaving like normal HTML block elements. If only vertical scrolling is enabled, make sure the content always fits or wraps.

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

Default value is 'auto'.

addContent

Adds some content to the aggregation content.

Param Type DefaultValue Description
oContent sap.ui.core.Control

The content to add; if empty, nothing is inserted

destroyContent

Destroys all the content in the aggregation content.

sap.m.ScrollContainer.extend

Creates a new subclass of class sap.m.ScrollContainer 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

getContent

Gets content of aggregation content.

The content of the ScrollContainer.

getFocusable

Gets current value of property focusable.

Whether the scroll container can be focused.

Note that it should be set to "true" when there are no focusable elements inside or when keyboard interaction requires an additional tab stop on the container.

Default value is false.

getHeight

Gets current value of property height.

The height of the ScrollContainer. By default the height equals the content height. If only horizontal scrolling is used, do not set the height or make sure the height is always larger than the height of the content.

Note that when a percentage is given, for the height to work as expected, the height of the surrounding container must be defined.

Default value is 'auto'.

getHorizontal

Gets current value of property horizontal.

Whether horizontal scrolling should be possible.

Default value is true.

sap.m.ScrollContainer.getMetadata

Returns a metadata object for class sap.m.ScrollContainer.

getVertical

Gets current value of property vertical.

Whether vertical scrolling should be possible.

Note that this is off by default because typically a Page is used as fullscreen element which can handle vertical scrolling. If this is not the case and vertical scrolling is required, this flag needs to be set to "true". Important: it is not supported to have nested controls that both enable scrolling into the same dimension.

Default value is false.

getWidth

Gets current value of property width.

The width of the ScrollContainer. If not set, it consumes the complete available width, behaving like normal HTML block elements. If only vertical scrolling is enabled, make sure the content always fits or wraps.

Default value is 'auto'.

indexOfContent

Checks for the provided sap.ui.core.Control in the aggregation content. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oContent sap.ui.core.Control

The content whose index is looked for

insertContent

Inserts a content into the aggregation content.

Param Type DefaultValue Description
oContent sap.ui.core.Control

The content to insert; if empty, nothing is inserted

iIndex int

The 0-based index the content should be inserted at; for a negative value of iIndex, the content is inserted at position 0; for a value greater than the current size of the aggregation, the content is inserted at the last position

removeAllContent

Removes all the controls from the aggregation content.

Additionally, it unregisters them from the hosting UIArea.

removeContent

Removes a content from the aggregation content.

Param Type DefaultValue Description
vContent int string sap.ui.core.Control

The content to remove or its index or id

scrollTo

Scrolls to the given position. When called while the control is not rendered (yet), the scrolling position is still applied, but there is no animation.

Param Type DefaultValue Description
x int

The horizontal pixel position to scroll to. Scrolling to the right happens with positive values. In right-to-left mode scrolling starts at the right side and higher values scroll to the left. If only vertical scrolling is enabled, give 0 as value.

y int

The vertical pixel position to scroll to. Scrolling down happens with positive values. If only horizontal scrolling is enabled, give 0 as value.

time int 0

The duration of animated scrolling in milliseconds. The value 0 results in immediate scrolling without animation.

scrollToElement

Scrolls to an element(DOM or sap.ui.core.Element) within the page if the element is rendered.

Param Type DefaultValue Description
element HTMLElement sap.ui.core.Element

The element to which should be scrolled.

time int 0

The duration of animated scrolling. To scroll immediately without animation, give 0 as value or leave it default.

setFocusable

Sets a new value for property focusable.

Whether the scroll container can be focused.

Note that it should be set to "true" when there are no focusable elements inside or when keyboard interaction requires an additional tab stop on the container.

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
bFocusable boolean false

New value for property focusable

setHeight

Sets a new value for property height.

The height of the ScrollContainer. By default the height equals the content height. If only horizontal scrolling is used, do not set the height or make sure the height is always larger than the height of the content.

Note that when a percentage is given, for the height to work as expected, the height of the surrounding container must be defined.

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

Default value is 'auto'.

Param Type DefaultValue Description
sHeight sap.ui.core.CSSSize 'auto'

New value for property height

setHorizontal

Sets a new value for property horizontal.

Whether horizontal scrolling should be possible.

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
bHorizontal boolean true

New value for property horizontal

setVertical

Sets a new value for property vertical.

Whether vertical scrolling should be possible.

Note that this is off by default because typically a Page is used as fullscreen element which can handle vertical scrolling. If this is not the case and vertical scrolling is required, this flag needs to be set to "true". Important: it is not supported to have nested controls that both enable scrolling into the same dimension.

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
bVertical boolean false

New value for property vertical

setWidth

Sets a new value for property width.

The width of the ScrollContainer. If not set, it consumes the complete available width, behaving like normal HTML block elements. If only vertical scrolling is enabled, make sure the content always fits or wraps.

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

Default value is 'auto'.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize 'auto'

New value for property width