Class sap.ui.core.ScrollBarModule: sap/ui/core/ScrollBar

extends Control

The ScrollBar control can be used for virtual scrolling of a certain area. This means: to simulate a very large scrollable area when technically the area is small and the control takes care of displaying the respective part only. E.g. a Table control can take care of only rendering the currently visible rows and use this ScrollBar control to make the user think he actually scrolls through a long list.

Constructor Summary
new sap.ui.core.ScrollBar(sId?, mSettings?)Constructor for a new ScrollBar.
Event Summary
scroll(oControlEvent)Scroll event.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.core.ScrollBar.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.ScrollBar with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.ScrollBar.getMetadata()Returns a metadata object for class sap.ui.core.ScrollBar.
attachScroll(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the scroll event of this sap.ui.core.ScrollBar.
bind(oOwnerDomRef)Binds the mouse wheel scroll event of the control that has the scrollbar to the scrollbar itself.
detachScroll(fnFunction, oListener)Detaches event handler fnFunction from the scroll event of this sap.ui.core.ScrollBar.
fireScroll(mArguments?)Fires event scroll to attached listeners.
getContentSize()Gets current value of property contentSize.
getScrollPosition()Gets current value of property scrollPosition.
getSize()Gets current value of property size.
getSteps()Gets current value of property steps.
getVertical()Gets current value of property vertical.
pageDown()Page Down is used to scroll one page forward.
pageUp()Page Up is used to scroll one page back.
setContentSize(sContentSize)Sets a new value for property contentSize.
setScrollPosition(iScrollPosition)Sets a new value for property scrollPosition.
setSize(sSize)Sets a new value for property size.
setSteps(iSteps)Sets a new value for property steps.
setVertical(bVertical)Sets a new value for property vertical.
unbind(oOwnerDomRef)Unbinds the mouse wheel scroll event of the control that has the scrollbar
Constructor Detail
new sap.ui.core.ScrollBar(sId?, mSettings?)
Constructor for a new ScrollBar.

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:

  • Properties
  • Events
    • scroll : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

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
scroll(oControlEvent)
Scroll event.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{sap.ui.core.ScrollBarAction}oControlEvent.getParameters.action Actions are: Click on track, button, drag of thumb, or mouse wheel click.
{boolean}oControlEvent.getParameters.forward Direction of scrolling: back (up) or forward (down).
{int}oControlEvent.getParameters.newScrollPos Current Scroll position either in pixels or in steps.
{int}oControlEvent.getParameters.oldScrollPos Old Scroll position - can be in pixels or in steps.
Method Detail
sap.ui.core.ScrollBar.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.ScrollBar 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.core.ScrollBar.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.ScrollBar.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachScroll(oData?, fnFunction, oListener?): sap.ui.core.ScrollBar
Attaches event handler fnFunction to the scroll event of this sap.ui.core.ScrollBar.

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.core.ScrollBar itself.

Scroll event.

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.core.ScrollBar itself
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
bind(oOwnerDomRef)
Binds the mouse wheel scroll event of the control that has the scrollbar to the scrollbar itself.
Parameters:
{string}oOwnerDomRef Dom ref of the control that uses the scrollbar
detachScroll(fnFunction, oListener): sap.ui.core.ScrollBar
Detaches event handler fnFunction from the scroll event of this sap.ui.core.ScrollBar.

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.core.ScrollBar} Reference to this in order to allow method chaining
fireScroll(mArguments?): sap.ui.core.ScrollBar
Fires event scroll to attached listeners.

Expects the following event parameters:

  • action of type sap.ui.core.ScrollBarActionActions are: Click on track, button, drag of thumb, or mouse wheel click.
  • forward of type booleanDirection of scrolling: back (up) or forward (down).
  • newScrollPos of type intCurrent Scroll position either in pixels or in steps.
  • oldScrollPos of type intOld Scroll position - can be in pixels or in steps.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
getContentSize(): sap.ui.core.CSSSize
Gets current value of property contentSize.

Size of the scrollable content (in pixels).

Returns:
{sap.ui.core.CSSSize} Value of property contentSize
getScrollPosition(): int
Gets current value of property scrollPosition.

Scroll position in steps or pixels.

Returns:
{int} Value of property scrollPosition
Gets current value of property size.

Size of the Scrollbar (in pixels).

Returns:
{sap.ui.core.CSSSize} Value of property size
getSteps(): int
Gets current value of property steps.

Number of steps to scroll. Used if the size of the content is not known as the data is loaded dynamically.

Returns:
{int} Value of property steps
getVertical(): boolean
Gets current value of property vertical.

Orientation. Defines if the Scrollbar is vertical or horizontal.

Default value is true.

Returns:
{boolean} Value of property vertical
pageDown()
Page Down is used to scroll one page forward.
pageUp()
Page Up is used to scroll one page back.
setContentSize(sContentSize): sap.ui.core.ScrollBar
Sets a new value for property contentSize.

Size of the scrollable content (in pixels).

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

Parameters:
{sap.ui.core.CSSSize}sContentSize New value for property contentSize
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
setScrollPosition(iScrollPosition): sap.ui.core.ScrollBar
Sets a new value for property scrollPosition.

Scroll position in steps or pixels.

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

Parameters:
{int}iScrollPosition New value for property scrollPosition
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
setSize(sSize): sap.ui.core.ScrollBar
Sets a new value for property size.

Size of the Scrollbar (in pixels).

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

Parameters:
{sap.ui.core.CSSSize}sSize New value for property size
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
setSteps(iSteps): sap.ui.core.ScrollBar
Sets a new value for property steps.

Number of steps to scroll. Used if the size of the content is not known as the data is loaded dynamically.

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

Parameters:
{int}iSteps New value for property steps
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
setVertical(bVertical): sap.ui.core.ScrollBar
Sets a new value for property vertical.

Orientation. Defines if the Scrollbar is vertical or horizontal.

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

Default value is true.

Parameters:
{boolean}bVertical New value for property vertical
Returns:
{sap.ui.core.ScrollBar} Reference to this in order to allow method chaining
unbind(oOwnerDomRef)
Unbinds the mouse wheel scroll event of the control that has the scrollbar
Parameters:
{string}oOwnerDomRef Dom ref of the Control that uses the scrollbar