Knockout-jQueryUI

Fork me on GitHub

Progressbar.html

Display status of a determinate or indeterminate process.

Parameters

For each of the widget's options the binding has a corresponding option with the same name. These can be set to static values, or bound either to normal or to observable properties of the viewmodel.

For each of the widget's events the binding has a corresponding option with the same name. These can be set to functions. When invoked the value of the this keyword evaluates to the viewmodel.

widget

Should be bound to one of the viewmodel's writeable observables. The binding will write a jQuery object containing the binding's DOM element into it. The primary use for this option is to invoke the widget's methods on the element.

Example

HTML

<p>
  <select data-bind="value: selected">
    <option value="25">25</option>
    <option value="50">50</option>
    <option value="75">75</option>
  </select>
</p>
<p>
  <div style="width: 100px; height: 15px;" data-bind="progressbar: { value: value }"></div>
</p>

JavaScript

var ViewModel = function () {
  this.selected = ko.observable('25');
  this.value = ko.computed({
    read: function() {
      return parseInt(this.selected())
    },
    write: function(newValue) {
      this.selected(newValue.toString());
    },
    owner: this
  });
};

Result