The ScrollContainer is a control that can display arbitrary content within a limited screen area and provides scrolling to make all content accessible.
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).
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 |
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 |
Default Aggregation: content
Name | Cardinality | Type | Description |
---|---|---|---|
content (default) | 0..n | sap.ui.core.Control |
The content of the ScrollContainer. |
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
|
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 |
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 |
getHorizontal |
Gets current value of property horizontal. Whether horizontal scrolling should be possible. Default value is |
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 |
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 |
indexOfContent |
Checks for the provided |
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 Default value is |
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 Default value is |
setHorizontal |
Sets a new value for property horizontal. Whether horizontal scrolling should be possible. When called with a value of Default value is |
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 Default value is |
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 Default value is |
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 |
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 |
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
.
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'
.
Gets current value of property horizontal.
Whether horizontal scrolling should be possible.
Default value is true
.
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
.
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'
.
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 |
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 |
Removes all the controls from the aggregation content.
Additionally, it unregisters them from the hosting UIArea.
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 |
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 |
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. |
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 |
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 |
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 |
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 |
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 |