Data-binding options:
Example:
In this example, the ViewModel is defined specifically for use with the pager. It has disabled, pageCount, and pageIndex 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. This gauge starts at 40 and goes up to 150.
Create a ViewModel:
ViewModel Script |
Copy Code |
---|---|
var viewModel = function () { var self = this; self.disabled = ko.observable(false); self.pageCount = ko.observable(150); self.pageIndex = ko.observable(40); }; |
Create View with Bound Controls:
View Markup |
Copy Code |
---|---|
<div data-bind="wijpager: {disabled: disabled, pageCount: pageCount, pageIndex: pageIndex}"> </div> |