Class sap.ui.commons.SliderModule: sap/ui/commons/Slider

extends Control
known direct subclasses: RangeSlider

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.

Deprecated API:Since version 1.38. Instead, use the sap.m.Slider control.

Constructor Summary
new sap.ui.commons.Slider(sId?, mSettings?)Constructor for a new Slider.
Event Summary
change(oControlEvent)Value was changed.
liveChange(oControlEvent)Value was changed.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.Slider.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.Slider with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.Slider.getMetadata()Returns a metadata object for class sap.ui.commons.Slider.
addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy.
addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy.
attachChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the change event of this sap.ui.commons.Slider.
attachLiveChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the liveChange event of this sap.ui.commons.Slider.
detachChange(fnFunction, oListener)Detaches event handler fnFunction from the change event of this sap.ui.commons.Slider.
detachLiveChange(fnFunction, oListener)Detaches event handler fnFunction from the liveChange event of this sap.ui.commons.Slider.
fireChange(mArguments?)Fires event change to attached listeners.
fireLiveChange(mArguments?)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.
getEnabled()Gets current value of property enabled.
getHeight()Gets current value of property height.
getLabels()Gets current value of property labels.
getMax()Gets current value of property max.
getMin()Gets current value of property min.
getSmallStepWidth()Gets current value of property smallStepWidth.
getStepLabels()Gets current value of property stepLabels.
getTotalUnits()Gets current value of property totalUnits.
getValue()Gets current value of property value.
getVertical()Gets current value of property vertical.
getWidth()Gets current value of property width.
removeAllAriaDescribedBy()Removes all the controls in the association named ariaDescribedBy.
removeAllAriaLabelledBy()Removes all the controls in the association named ariaLabelledBy.
removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy.
removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy.
setEditable(bEditable)Sets a new value for property editable.
setEnabled(bEnabled)Sets a new value for property enabled.
setHeight(sHeight)Sets a new value for property height.
setLabels(sLabels)Sets a new value for property labels.
setMax(fMax)Sets a new value for property max.
setMin(fMin)Sets a new value for property min.
setSmallStepWidth(fSmallStepWidth)Sets a new value for property smallStepWidth.
setStepLabels(bStepLabels)Sets a new value for property stepLabels.
setTotalUnits(iTotalUnits)Sets a new value for property totalUnits.
setValue(fValue)Sets a new value for property value.
setVertical(bVertical)Sets a new value for property vertical.
setWidth(sWidth)Sets a new value for property width.
Constructor Detail
new sap.ui.commons.Slider(sId?, mSettings?)
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 for a general description of the syntax of the settings object.

The supported settings are:

  • Properties
  • Events
    • change : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • liveChange : 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
Deprecated:
Since version 1.38. Instead, use the sap.m.Slider control.
Event Detail
change(oControlEvent)
Value was changed. This event is fired if the value has changed by an user action.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{float}oControlEvent.getParameters.value Current value of the slider after a change.
liveChange(oControlEvent)
Value was changed. This event is fired during the mouse move. The normal change event is only fired by mouseup.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{float}oControlEvent.getParameters.value Current value of the slider after a change.
Method Detail
sap.ui.commons.Slider.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

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.commons.Slider.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.Slider.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.Slider
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
{string|sap.ui.core.Control}vAriaDescribedBy the ariaDescribedBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.Slider
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
{string|sap.ui.core.Control}vAriaLabelledBy the ariaLabelledBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
attachChange(oData?, fnFunction, oListener?): sap.ui.commons.Slider
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 an user action.

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.commons.Slider itself
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
attachLiveChange(oData?, fnFunction, oListener?): sap.ui.commons.Slider
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.

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.commons.Slider itself
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
detachChange(fnFunction, oListener): sap.ui.commons.Slider
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.

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.commons.Slider} Reference to this in order to allow method chaining
detachLiveChange(fnFunction, oListener): sap.ui.commons.Slider
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.

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.commons.Slider} Reference to this in order to allow method chaining
fireChange(mArguments?): sap.ui.commons.Slider
Fires event change to attached listeners.

Expects the following event parameters:

  • value of type floatCurrent value of the slider after a change.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
fireLiveChange(mArguments?): sap.ui.commons.Slider
Fires event liveChange to attached listeners.

Expects the following event parameters:

  • value of type floatCurrent value of the slider after a change.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
getAriaDescribedBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
{sap.ui.core.Control[]}
getAriaLabelledBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
{sap.ui.core.Control[]}
getEditable(): boolean
Gets current value of property editable.

Using the slider interactively requires value "true".

Default value is true.

Returns:
{boolean} Value of property editable
getEnabled(): boolean
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.

Returns:
{boolean} Value of property enabled
getHeight(): sap.ui.core.CSSSize
Gets current value of property height.

Height of the vertical slider.

Default value is 100%.

Since:
1.7.1
Returns:
{sap.ui.core.CSSSize} Value of property height
getLabels(): string[]
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.

Returns:
{string[]} Value of property labels
getMax(): float
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.

Returns:
{float} Value of property max
getMin(): float
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.

Returns:
{float} Value of property min
getSmallStepWidth(): float
Gets current value of property smallStepWidth.

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

Returns:
{float} Value of property smallStepWidth
getStepLabels(): boolean
Gets current value of property stepLabels.

Display step numbers for the ticks on the slider.

Default value is false.

Returns:
{boolean} Value of property stepLabels
getTotalUnits(): int
Gets current value of property totalUnits.

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

Returns:
{int} Value of property totalUnits
getValue(): float
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.

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

Orientation of slider

Default value is false.

Since:
1.7.1
Returns:
{boolean} Value of property vertical
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

Width of the horizontal slider.

Default value is 100%.

Returns:
{sap.ui.core.CSSSize} Value of property width
removeAllAriaDescribedBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.Control
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaDescribedBy The ariaDescribedByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.Control
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaLabelledBy The ariaLabelledByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaLabelledBy or null
setEditable(bEditable): sap.ui.commons.Slider
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.

Parameters:
{boolean}bEditable New value for property editable
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setEnabled(bEnabled): sap.ui.commons.Slider
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.

Parameters:
{boolean}bEnabled New value for property enabled
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setHeight(sHeight): sap.ui.commons.Slider
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%.

Parameters:
{sap.ui.core.CSSSize}sHeight New value for property height
Since:
1.7.1
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setLabels(sLabels): sap.ui.commons.Slider
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.

Parameters:
{string[]}sLabels New value for property labels
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setMax(fMax): sap.ui.commons.Slider
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.

Parameters:
{float}fMax New value for property max
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setMin(fMin): sap.ui.commons.Slider
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.

Parameters:
{float}fMin New value for property min
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setSmallStepWidth(fSmallStepWidth): sap.ui.commons.Slider
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.

Parameters:
{float}fSmallStepWidth New value for property smallStepWidth
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setStepLabels(bStepLabels): sap.ui.commons.Slider
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.

Parameters:
{boolean}bStepLabels New value for property stepLabels
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setTotalUnits(iTotalUnits): sap.ui.commons.Slider
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.

Parameters:
{int}iTotalUnits New value for property totalUnits
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setValue(fValue): sap.ui.commons.Slider
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.

Parameters:
{float}fValue New value for property value
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setVertical(bVertical): sap.ui.commons.Slider
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.

Parameters:
{boolean}bVertical New value for property vertical
Since:
1.7.1
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.Slider
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%.

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Returns:
{sap.ui.commons.Slider} Reference to this in order to allow method chaining