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

Data-binding options:

Example:

In this example, the ViewModel is defined specifically for use with the list. It has disabled, selectionMode, autoSize, maxItemsCount, addHoverItemClass, keepHighlightOnMouseLeave, and listItems 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.disabled = ko.observable(false);
     self.selectionMode = ko.observable('single');
     self.autoSize = ko.observable(true);
     self.maxItemsCount = ko.observable(5); 
     self.addHoverItemClass = ko.observable(true); 
     self.keepHightlightOnMouseLeave = ko.observable(false); 
     self.listItems = ko.observableArray(createList());
};

Create View with Bound Controls:

View Markup
Copy Code
<div id="list" style="width:300px" data-bind="wijlist: { 
    disabled: disabled, 
    selectionMode: selectionMode, 
    autoSize: autoSize, 
    maxItemsCount: maxItemsCount, 
    addHoverItemClass: addHoverItemClass, 
    keepHightlightOnMouseLeave: keepHightlightOnMouseLeave, 
    listItems: listItems}">
</div>
See Also

Concepts

Widgets

Reference