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

Data-binding options:

Example:

In this example, the ViewModel is defined specifically for use with the rating. It has disabled, count, max, split, and valueproperties 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. This rating has an initial value of 3, each star is split into 2 sections, and there are 5 stars, however, the highest possible rating is 4 stars.

Create a ViewModel:

ViewModel Script
Copy Code
var viewModel =  = function () {         
   var self = this;         
       self.val = ko.observable(3);     
       self.min = ko.observable(null);
       self.max = ko.observable(null);
       self.disabled = ko.observable(false);
       self.count = ko.observable(5);
       self.totalValue = ko.observable(5);
       self.split = ko.observable(1);
};

Create View with Bound Controls:

View Markup
Copy Code
<div data-bind="wijrating: { 
    value: val, 
    min: min, 
    max: max, 
    disabled: disabled, 
    count: count, 
    totalValue: totalValue, 
    split: split }">
</div>
See Also

Concepts

Widgets

Reference