I am working a set of data that contains arrays as IDs. I need some help working around this as it appears unsupported and breaks some things.
Example item from the first set of data:
{ "id":[1,2,3,4], "name":"Another VIP-VID-INPUT-1", "internal":true}This data is referenced from second set of data which uses the same array IDs to refer to the first set. Example item from the second set of data:
{ "id":2, "name":"Link 02", "head_port_id":[1,2,3,4], "tail_port_id":[2,2,3,4], "disabled":false}For starters I am populating a Grid with the second set of data. I use a column.template to replace "head_port_id" and "tail_port_id" with the relevant "name" field from the first set of data. This works fine.
The problem arises when I try to use a DropDownMenu inside column.editor for the "head_port_id" and "tail_port_id" columns. Clicking the cell causes an error.
editor: function(container, options) { var editor = $('<input />') .attr('name', options.field) // "head_port_id" .attr('required', 'required') .attr('data-bind', 'value:' + options.field); // "head_port_id" container.append(editor); editor.kendoDropDownList({ autoBind: false, dataSource: data.ports.datasource, // the first set of data dataTextField: 'name', dataValueField: 'id' });}
Uncaught TypeError: o[s].get is not a functionE.widget.value.v.extend.refresh @ kendo.all.js:8886I.extend.bind @ kendo.all.js:8153w.extend.applyBinding @ kendo.all.js:9146I.extend.bind @ kendo.all.js:9096a @ kendo.all.js:9239a @ kendo.all.js:9247a @ kendo.all.js:9247s @ kendo.all.js:9262c.extend.refresh @ kendo.all.js:36822c.extend.init @ kendo.all.js:36731(anonymous function) @ kendo.all.js:2382b.extend.each @ jquery-1.9.1.min.js:3b.fn.b.each @ jquery-1.9.1.min.js:3e.fn.(anonymous function) @ kendo.all.js:2381ue.ui.DataBoundWidget.extend.editCell @ kendo.all.js:45210(anonymous function) @ kendo.all.js:45168b.event.dispatch @ jquery-1.9.1.min.js:3v.handle @ jquery-1.9.1.min.js:3Since I have the minified code it's difficult to debug this, even though I can see the full source code (a source map is loaded I assume). Breakpoints and scope vars aren't cooperating.
Anyway I had an idea which was to define a "parse" function for all of the array ID fields, in my Models. It simply converted the ID arrays .toString(). This works pretty well except that it has a fatal flaw in which the data I send to the relevant service is now invalid, since the service is expecting arrays and not strings.
How can I convert these IDs back to arrays, ideally without doing this in the DataSource transport functions (update, create, etc)? I have a generic DataSource wrapper that I am using to wrap our own CRUD interface.. I don't want it to have special cases in it for this once type of data.