Slider

Description

The Slider widget allows a user to select a single value from a range.

Official Kendo UI Slider documentation

Examples

  • Basic Example
  • Passing additional options
  • Using global options

This example demonstrates passing a single option to bind against the value of the Slider widget.

<input data-bind="kendoSlider: myValue" />
<hr/>
Value: <strong data-bind="text: myValue"> </strong>
var ViewModel = function() {
   this.myValue = ko.observable(4);
};

                            ko.applyBindings(new ViewModel());

Value:

This example demonstrates passing additional options in the data-bind attribute with value now being explicitly specified. The Set to 50 button makes an update to the view model to show that the widget responds accordingly.

<input data-bind="checked: enabled" type="checkbox" /> Enabled<br/>
<button data-bind="click: setToDefault">Set to 50</button>
<hr/>
<input data-bind="kendoSlider: { value: myValue, enabled: enabled, min: 0, max: 100 }" />
<hr/>
Value: <strong data-bind="text: myValue"> </strong>
var ViewModel = function() {
    this.myValue = ko.observable(40);
    this.enabled = ko.observable(true);
    this.setToDefault  = function() {
        this.myValue(50);
    };
};

                            ko.applyBindings(new ViewModel());
Enabled


Value:

This example demonstrates setting global options in ko.bindingHandlers.kendoSlider.options. This helps to simplify the markup for settings that can be used as a default for all instances of this widget.

<input data-bind="kendoSlider: myValue" />
<hr/>
Value: <strong data-bind="text: myValue"> </strong>
var ViewModel = function() {
    this.myValue = ko.observable(40);
};

ko.bindingHandlers.kendoSlider.options = {
    min: 0,
    max: 100
};

                            ko.applyBindings(new ViewModel());

Value:

Live Options

The kendoSlider.md binding accepts all of the options that can be specified for the widget. However, when bound against an observable, these live options will update the widget or respond to updates from interactions with the widget.
enabled

Determines if users can interact with the field

value

The current value of the slider

widget

If specified, will populate an observable with a reference to the actual widget