knockout.js - Knockout Kendo and primitive values -
i know, why non primitive values not working in kendo-knockout bindings.
i have 2 dropdownlists:
<!-- 1 works fine --> <input data-bind="kendodropdownlist: { data: names, value: selectectedvalue1, datatextfield: 'name', datavaluefield: 'id', valueprimitive: true }" /> <!-- 1 doesn't work --> <input data-bind="kendodropdownlist: { data: names, value: selectectedvalue2, datatextfield: 'name', datavaluefield: 'id', valueprimitive: false }" />
and simple vm:
var datajs = [{'id':1,'name':'name 1'}, {'id':2,'name':'name 2'}, {'id':3,'name':'name 3'}, {'id':4,'name':'name 4'}, {'id':5,'name':'name 5'} ]; var viewmodel = function() { this.names = ko.observablearray(datajs); this.selectectedvalue1= ko.observable(null); this.selectectedvalue2= ko.observable(null); }; ko.applybindings(new viewmodel());
first dropdown using primitive value, second should bind whole object. doesn't work. both selected values primitives id. why?
fiddle: http://jsfiddle.net/raptorcz/4x710zbn/
only way found create computed object collection based on selected id.
Comments
Post a Comment