Wijmo UI for the Web
KO Slider Binding
Wijmo User Guide > Concepts > Integrating Frameworks > Knockout > Two-Way Live Binding > KO Slider Binding

Data-binding options:

Example:

In this example, the ViewModel is defined specifically for use with the slider. It has disabled, val, min, max, animate, range, step, dragFill, minRange, and vals properties that are bound in the View. If any of these values change, the widgets automatically respond to them. The widgets also update the ViewModel values as they modify them.

Create a ViewModel:

ViewModel Script
Copy Code
var viewModel = function () {             
   var self = this; 
   self.val = ko.observable(50); 
   self.min = ko.observable(0);
   self.max = ko.observable(100); 
   self.disabled = ko.observable(false); 
   self.animate = ko.observable(false);     
   self.range = ko.observable(false);     
   self.step = ko.observable(1);         
   self.dragFill = ko.observable(true);     
   self.minRange = ko.observable(0);     
   self.vals = ko.observableArray([10, 50]);
};

Create View with Bound Controls:

View Markup
Copy Code
<div data-bind="wijslider: {
    value: val, 
    min: min, 
    max: max, 
    disabled: disabled, 
    animate: animate, 
    range: range, 
    step: step, 
    dragFill: dragFill, 
    minRange: minRange}">
</div>
See Also

Widgets

Concepts

Reference