So I've got a model passed in like so:
Now in my javascript I take my model and convert:
Now when I call the editor function in the grid:
After click on the column I get the following error:
Which is referring to the only id in the array of 'CategoryIds'. I'm putting this question in Multiselect because I am using editor functions for several other columns and not having this issue. Any thoughts?
public class MainViewModel{ public IList<SubViewModel> SubViewModels;} public class SubViewModel{ public Guid Id; public string Name; public IList<Guid> CategoryIds; public IList<CategoryType> CategoryTypes;} public class CategoryType { public Guid Id; public string Type;}var initialData = @Html.Raw(JsonConvert.SerializeObject(Model, new JavaScriptDateTimeConverter()));var mainViewModel = new MainViewModel(initialData);function MainViewModel(data) { var mapping = { 'SubViewModels': create: function(options) { return new SubViewModel(options.data); } } ko.mapping.fromJS(data, mapping , this);}function SubViewModel(
var self = this;
ko.mapping.fromJS(data, mapping , self); self.CategoryMultiSelect: function (container, options) { $('<input data-bind="value:' + options.field + '"/>') .appendTo(container) .kendoMultiSelect({ autoBind: false, dataTextField: "Type", dataValueField: "Id", dataSource: options.model.CategoryTypes }); }}
ko.applyBindings(mainViewModel, $("#MainViewModel")[0]);
<div id="subviewModelGrid" data-bind="kendoGrid: { data: $data.SubViewModels, sortable: true, scrollable: false,
editable: true, pageable: { pageSize: 10, input: false }, columns: [{ field: 'CategoryIds', title: 'Categories', width: '300px', editor: $data.CategoryMultiSelect }]}"/>After click on the column I get the following error:
Uncaught TypeError: Object f7ae02dc-c8a7-f112-e043-991018ace7d8 has no method 'get' kendo.web.min.js:12S.widget.value.m.extend.refresh kendo.web.min.js:12F.extend.bind kendo.web.min.js:11v.extend.applyBinding kendo.web.min.js:12v.extend.bind kendo.web.min.js:12o kendo.web.min.js:11o kendo.web.min.js:11o kendo.web.min.js:11s kendo.web.min.js:11d.extend.refresh kendo.web.min.js:22d.extend.init kendo.web.min.js:22(anonymous function) kendo.web.min.js:9p.extend.each jquery-1.8.2.min.js:2p.fn.p.each jquery-1.8.2.min.js:2e.fn.(anonymous function) kendo.web.min.js:9T.extend.editCell kendo.web.min.js:17r.incell.r.update.n.wrapper.on.on.n.timer kendo.web.min.js:17p.event.dispatch jquery-1.8.2.min.js:2g.handle.hWhich is referring to the only id in the array of 'CategoryIds'. I'm putting this question in Multiselect because I am using editor functions for several other columns and not having this issue. Any thoughts?