class sap.ui.commons.Slider

Control sample: sap.ui.commons.Slider
Visiblity: public
UX Guidelines:
Implements: sap.ui.core.IFormContent
Available since: N/A
Module: sap/ui/commons/Slider
Application Component: CA-UI5-CTR

The interactive control is displayed either as a horizontal or a vertical line with a pointer and units of measurement. Users can move the pointer along the line to change values with graphical support.


Constructor

Constructor for a new Slider.

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.ui.commons.Slider(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
editable boolean true

Using the slider interactively requires value "true".

Visibility: public
enabled boolean true

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

Visibility: public
height sap.ui.core.CSSSize 100%

Height of the vertical slider.

Since: 1.7.1.

Visibility: public
labels string[]

Labels to be displayed instead of numbers. Attribute totalUnits and label count should be the same

Note: To show the labels stepLabels must be activated.

Visibility: public
max float 100

Maximal value of the slider

Note: If min is larger than max both values will be switched

Visibility: public
min float 0

Minimal value of the slider.

Note: If min is larger than max both values will be switched

Visibility: public
smallStepWidth float

The grip can only be moved in steps of this width.

Visibility: public
stepLabels boolean false

Display step numbers for the ticks on the slider.

Visibility: public
totalUnits int

Number of units that are displayed by ticks. The PageUp and PageDown keys navigate according to these units.

Visibility: public
value float 50

Current value of the slider. (Position of the grip.)

Note: If the value is not in the valid range (between min and max) it will be changed to be in the valid range.

Visibility: public
vertical boolean false

Orientation of slider

Since: 1.7.1.

Visibility: public
width sap.ui.core.CSSSize 100%

Width of the horizontal slider.

Visibility: public

Associations

Name Cardinality Type Description
ariaDescribedBy 0..n sap.ui.core.Control

Association to controls / IDs which describe this control (see WAI-ARIA attribute aria-describedby).

ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / IDs which label this control (see WAI-ARIA attribute aria-labelledby).


Events Overview

Event Description
change

Value was changed. This event is fired if the value has changed by a user action.

liveChange

Value was changed. This event is fired during the mouse move. The normal change event is only fired by mouseup.

change

Value was changed. This event is fired if the value has changed by a user action.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
value float

Current value of the slider after a change.

liveChange

Value was changed. This event is fired during the mouse move. The normal change event is only fired by mouseup.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
value float

Current value of the slider after a change.


Methods Overview

Method Description
addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

attachChange

Attaches event handler fnFunction to the change event of this sap.ui.commons.Slider.

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.commons.Slider itself.

Value was changed. This event is fired if the value has changed by a user action.

attachLiveChange

Attaches event handler fnFunction to the liveChange event of this sap.ui.commons.Slider.

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.commons.Slider itself.

Value was changed. This event is fired during the mouse move. The normal change event is only fired by mouseup.

detachChange

Detaches event handler fnFunction from the change event of this sap.ui.commons.Slider.

The passed function and listener object must match the ones used for event registration.

detachLiveChange

Detaches event handler fnFunction from the liveChange event of this sap.ui.commons.Slider.

The passed function and listener object must match the ones used for event registration.

sap.ui.commons.Slider.extend

Creates a new subclass of class sap.ui.commons.Slider 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.

fireChange

Fires event change to attached listeners.

fireLiveChange

Fires event liveChange to attached listeners.

getAriaDescribedBy

Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getEditable

Gets current value of property editable.

Using the slider interactively requires value "true".

Default value is true.

getEnabled

Gets current value of property enabled.

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

Default value is true.

getHeight

Gets current value of property height.

Height of the vertical slider.

Default value is '100%'.

getLabels

Gets current value of property labels.

Labels to be displayed instead of numbers. Attribute totalUnits and label count should be the same

Note: To show the labels stepLabels must be activated.

getMax

Gets current value of property max.

Maximal value of the slider

Note: If min is larger than max both values will be switched

Default value is 100.

sap.ui.commons.Slider.getMetadata

Returns a metadata object for class sap.ui.commons.Slider.

getMin

Gets current value of property min.

Minimal value of the slider.

Note: If min is larger than max both values will be switched

Default value is 0.

getSmallStepWidth

Gets current value of property smallStepWidth.

The grip can only be moved in steps of this width.

getStepLabels

Gets current value of property stepLabels.

Display step numbers for the ticks on the slider.

Default value is false.

getTotalUnits

Gets current value of property totalUnits.

Number of units that are displayed by ticks. The PageUp and PageDown keys navigate according to these units.

getValue

Gets current value of property value.

Current value of the slider. (Position of the grip.)

Note: If the value is not in the valid range (between min and max) it will be changed to be in the valid range.

Default value is 50.

getVertical

Gets current value of property vertical.

Orientation of slider

Default value is false.

getWidth

Gets current value of property width.

Width of the horizontal slider.

Default value is '100%'.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

setEditable

Sets a new value for property editable.

Using the slider interactively requires value "true".

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

Default value is true.

setEnabled

Sets a new value for property enabled.

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

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

Default value is true.

setHeight

Sets a new value for property height.

Height of the vertical slider.

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

Default value is '100%'.

setLabels

Sets a new value for property labels.

Labels to be displayed instead of numbers. Attribute totalUnits and label count should be the same

Note: To show the labels stepLabels must be activated.

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

setMax

Sets a new value for property max.

Maximal value of the slider

Note: If min is larger than max both values will be switched

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

Default value is 100.

setMin

Sets a new value for property min.

Minimal value of the slider.

Note: If min is larger than max both values will be switched

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

Default value is 0.

setSmallStepWidth

Sets a new value for property smallStepWidth.

The grip can only be moved in steps of this width.

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

setStepLabels

Sets a new value for property stepLabels.

Display step numbers for the ticks on the slider.

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

Default value is false.

setTotalUnits

Sets a new value for property totalUnits.

Number of units that are displayed by ticks. The PageUp and PageDown keys navigate according to these units.

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

setValue

Sets a new value for property value.

Current value of the slider. (Position of the grip.)

Note: If the value is not in the valid range (between min and max) it will be changed to be in the valid range.

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

Default value is 50.

setVertical

Sets a new value for property vertical.

Orientation of slider

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.

Width of the horizontal slider.

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

Default value is '100%'.

addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to add; if empty, nothing is inserted

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

attachChange

Attaches event handler fnFunction to the change event of this sap.ui.commons.Slider.

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.commons.Slider itself.

Value was changed. This event is fired if the value has changed by a user action.

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.ui.commons.Slider itself

attachLiveChange

Attaches event handler fnFunction to the liveChange event of this sap.ui.commons.Slider.

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.commons.Slider itself.

Value was changed. This event is fired during the mouse move. The normal change event is only fired by mouseup.

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.ui.commons.Slider itself

detachChange

Detaches event handler fnFunction from the change event of this sap.ui.commons.Slider.

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

detachLiveChange

Detaches event handler fnFunction from the liveChange event of this sap.ui.commons.Slider.

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.ui.commons.Slider.extend

Creates a new subclass of class sap.ui.commons.Slider 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

fireChange

Fires event change to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

value float

Current value of the slider after a change.

fireLiveChange

Fires event liveChange to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

value float

Current value of the slider after a change.

getAriaDescribedBy

Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getEditable

Gets current value of property editable.

Using the slider interactively requires value "true".

Default value is true.

getEnabled

Gets current value of property enabled.

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

Default value is true.

getHeight

Gets current value of property height.

Height of the vertical slider.

Default value is '100%'.

getLabels

Gets current value of property labels.

Labels to be displayed instead of numbers. Attribute totalUnits and label count should be the same

Note: To show the labels stepLabels must be activated.

getMax

Gets current value of property max.

Maximal value of the slider

Note: If min is larger than max both values will be switched

Default value is 100.

sap.ui.commons.Slider.getMetadata

Returns a metadata object for class sap.ui.commons.Slider.

getMin

Gets current value of property min.

Minimal value of the slider.

Note: If min is larger than max both values will be switched

Default value is 0.

getSmallStepWidth

Gets current value of property smallStepWidth.

The grip can only be moved in steps of this width.

getStepLabels

Gets current value of property stepLabels.

Display step numbers for the ticks on the slider.

Default value is false.

getTotalUnits

Gets current value of property totalUnits.

Number of units that are displayed by ticks. The PageUp and PageDown keys navigate according to these units.

getValue

Gets current value of property value.

Current value of the slider. (Position of the grip.)

Note: If the value is not in the valid range (between min and max) it will be changed to be in the valid range.

Default value is 50.

getVertical

Gets current value of property vertical.

Orientation of slider

Default value is false.

getWidth

Gets current value of property width.

Width of the horizontal slider.

Default value is '100%'.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy int sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to be removed or its index or ID

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

setEditable

Sets a new value for property editable.

Using the slider interactively requires value "true".

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

New value for property editable

setEnabled

Sets a new value for property enabled.

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

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

New value for property enabled

setHeight

Sets a new value for property height.

Height of the vertical slider.

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

Default value is '100%'.

Param Type DefaultValue Description
sHeight sap.ui.core.CSSSize '100%'

New value for property height

setLabels

Sets a new value for property labels.

Labels to be displayed instead of numbers. Attribute totalUnits and label count should be the same

Note: To show the labels stepLabels must be activated.

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

Param Type DefaultValue Description
sLabels string[]

New value for property labels

setMax

Sets a new value for property max.

Maximal value of the slider

Note: If min is larger than max both values will be switched

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

Default value is 100.

Param Type DefaultValue Description
fMax float 100

New value for property max

setMin

Sets a new value for property min.

Minimal value of the slider.

Note: If min is larger than max both values will be switched

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

Default value is 0.

Param Type DefaultValue Description
fMin float 0

New value for property min

setSmallStepWidth

Sets a new value for property smallStepWidth.

The grip can only be moved in steps of this width.

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

Param Type DefaultValue Description
fSmallStepWidth float

New value for property smallStepWidth

setStepLabels

Sets a new value for property stepLabels.

Display step numbers for the ticks on the slider.

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

New value for property stepLabels

setTotalUnits

Sets a new value for property totalUnits.

Number of units that are displayed by ticks. The PageUp and PageDown keys navigate according to these units.

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

Param Type DefaultValue Description
iTotalUnits int

New value for property totalUnits

setValue

Sets a new value for property value.

Current value of the slider. (Position of the grip.)

Note: If the value is not in the valid range (between min and max) it will be changed to be in the valid range.

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

Default value is 50.

Param Type DefaultValue Description
fValue float 50

New value for property value

setVertical

Sets a new value for property vertical.

Orientation of slider

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.

Width of the horizontal slider.

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

Default value is '100%'.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize '100%'

New value for property width