in igCombo - How to display in the combo's input the selectedItem's tepmlate
For stackoverflow question:
http://stackoverflow.com/questions/18506957/in-igcombo-how-to-display-in-the-combos-input-the-selecteditems-tepmlate
HTML
<script src="http://cdn-na.infragistics.com/jquery/20131/latest/js/infragistics.loader.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js"></script>
<form id="form">
<span id="comboActors" data-bind="igCombo: {
dataSource: actors,
textKey: 'name',
itemTemplate: '${name} | ${id}',
valueKey: 'id',
allowCustomValue : true,
enableSelectionChangedUpdate: true,
width: '300',
mode: 'dropdown',
enableClearButton: false,
selectionChanged: function (evt, ui) {
var templatedValue = $.ig.tmpl(ui.owner.options.itemTemplate, ui.owner.options.dataSource[ui.items[0].index]);
ui.owner.text(templatedValue);}
}"></span>
<input type="submit" />
</form>
JavaScript
$.ig.loader({
scriptPath: 'http://cdn-na.infragistics.com/jquery/20131/latest/js/',
cssPath: 'http://cdn-na.infragistics.com/jquery/20131/latest/css/',
theme: 'metro',
resources: "igCombo,igShared,extensions/infragistics.ui.combo.knockout-extensions.js"
});
var model = [{
name: "Adam Sandler",
id: "nm0001191"
}, {
name: "Brooke Shields",
id: "nm0000222"
}, {
name: "Charles Chaplin",
id: "nm0000122"
}, {
name: "Charlize Theron",
id: "nm0000234"
}, {
name: "Dustin Hoffman",
id: "nm0000163"
}, {
name: "Hristo Shopov",
id: "nm0794885"
}, {
name: "Jeremy Irons",
id: "nm0000460"
}, {
name: "Noomi Rapace",
id: "nm0636426"
}, {
name: "Nicole Kidman ",
id: "nm0000173"
}, {
name: "Robert De Niro",
id: "nm0000134"
}, {
name: "Tom Cruise",
id: "nm0000129"
}, {
name: "Tom Hanks",
id: "nm0000158"
}];
var viewModel = new ViewModel(model);
function ViewModel(actorsList) {
this.actors = ko.observableArray(actorsList);
}
$.ig.loader(function () {
ko.applyBindings(viewModel);
});