If you need two way binding so that edits that take place on your viewmodel (after user interactions or an AJAX call), you need to create an option template (option being the html element that represents an item inside of a select html element).
Without two way binding:
<select data-text-field="firstName" data-value-field="id" data-bind="source: users, value: selecteUser"></select>
The solution:
<select data-text-field="firstName" data-value-field="id" data-template="optionTemplate" data-bind="source: users, value: selecteUser"></select>
<option data-bind="value:id,text:firstName"></option>
</script>
Resources:
No comments:
Post a Comment