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

Data-binding options:

Example:

In this example, the ViewModel is defined specifically for use with the combobox. It has disabled, labelText, showTrigger, triggerPosition, autoFilter, autoComplete, highlightMatching, selectionMode, isEditable, selectedIndex, and data properties that are bound in the View. If any of these values change, then the widgets will automatically respond to them. The widgets also update the ViewModel values as they modify them.

The trigger (drop-down arrow) is located on the left of the combobox, and you can select more than one item from the drop-down list.

Create a ViewModel:

ViewModel Script
Copy Code
var viewModel = function () {  
   var self = this;  
   self.disabled = ko.observable(false);
   self.labelText = ko.observable(null);
   self.showTrigger = ko.observable(true);
   self.triggerPosition = ko.observable('right'); 
   self.autoFilter = ko.observable(true); 
   self.autoComplete = ko.observable(true); 
   self.highlightMatching = ko.observable(true); 
   self.selectionMode = ko.observable('single'); 
   self.isEditable = ko.observable(true); 
   self.selectedIndex = ko.observable(-1); 
   self.data = ko.observable(createList());
};

Create View with Bound Controls:

View Markup
Copy Code
<input id="combo" data-bind="wijcombobox: { 
    disabled: disabled, 
    labelText: labelText, 
    showTrigger: showTrigger, 
    triggerPosition: triggerPosition, 
    isEditable: isEditable, 
    autoComplete: autoComplete, 
    autoFilter: autoFilter, 
    highlightMatching: highlightMatching, 
    selectedIndex: selectedIndex, 
    data: data,
    selectionMode:selectionMode}"/>
See Also

Widgets

Concepts

Reference