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

extends Control
implements IFormContent
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(mParameters?)Fires event change to attached listeners.
fireLiveChange(mParameters?)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

  • Associations

  • 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:
stringsId?ID for the new control, generated automatically if no ID is given
objectmSettings?Initial settings for the new control
Event Detail
change(oControlEvent)
Value was changed. This event is fired if the value has changed by a user action.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
floatoControlEvent.getParameters.valueCurrent 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.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
floatoControlEvent.getParameters.valueCurrent 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:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated 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.MetadataMetadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.Slider
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaDescribedBythe ariaDescribedBy to add; if empty, nothing is inserted
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.Slider
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledBythe ariaLabelledBy to add; if empty, nothing is inserted
Returns:
sap.ui.commons.SliderReference 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 a user action.

Parameters:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.ui.commons.Slider itself
Returns:
sap.ui.commons.SliderReference 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:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.ui.commons.Slider itself
Returns:
sap.ui.commons.SliderReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.ui.commons.SliderReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining
fireChange(mParameters?): sap.ui.commons.Slider
Fires event change to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
floatmParameters.value?Current value of the slider after a change.
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining
fireLiveChange(mParameters?): sap.ui.commons.Slider
Fires event liveChange to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
floatmParameters.value?Current value of the slider after a change.
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining
getAriaDescribedBy(): sap.ui.core.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
sap.ui.core.ID[]
getAriaLabelledBy(): sap.ui.core.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
sap.ui.core.ID[]
getEditable(): boolean

Gets current value of property editable.

Using the slider interactively requires value "true".

Default value is true.

Returns:
booleanValue 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:
booleanValue of property enabled
getHeight(): sap.ui.core.CSSSize

Gets current value of property height.

Height of the vertical slider.

Default value is 100%.

Returns:
sap.ui.core.CSSSizeValue of property height
Since:
1.7.1
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:
floatValue 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:
floatValue of property min
getSmallStepWidth(): float

Gets current value of property smallStepWidth.

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

Returns:
floatValue 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:
booleanValue 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:
intValue 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:
floatValue of property value
getVertical(): boolean

Gets current value of property vertical.

Orientation of slider

Default value is false.

Returns:
booleanValue of property vertical
Since:
1.7.1
getWidth(): sap.ui.core.CSSSize

Gets current value of property width.

Width of the horizontal slider.

Default value is 100%.

Returns:
sap.ui.core.CSSSizeValue of property width
removeAllAriaDescribedBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.ID
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaDescribedByThe ariaDescribedBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.ID
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledByThe ariaLabelledBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe 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:
booleanbEditableNew value for property editable
Returns:
sap.ui.commons.SliderReference 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:
booleanbEnabledNew value for property enabled
Returns:
sap.ui.commons.SliderReference 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.CSSSizesHeightNew value for property height
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining
Since:
1.7.1
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[]sLabelsNew value for property labels
Returns:
sap.ui.commons.SliderReference 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:
floatfMaxNew value for property max
Returns:
sap.ui.commons.SliderReference 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:
floatfMinNew value for property min
Returns:
sap.ui.commons.SliderReference 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:
floatfSmallStepWidthNew value for property smallStepWidth
Returns:
sap.ui.commons.SliderReference 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:
booleanbStepLabelsNew value for property stepLabels
Returns:
sap.ui.commons.SliderReference 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:
intiTotalUnitsNew value for property totalUnits
Returns:
sap.ui.commons.SliderReference 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:
floatfValueNew value for property value
Returns:
sap.ui.commons.SliderReference 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:
booleanbVerticalNew value for property vertical
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining
Since:
1.7.1
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.CSSSizesWidthNew value for property width
Returns:
sap.ui.commons.SliderReference to this in order to allow method chaining