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
function
E.widget.value.v.extend.refresh @ kendo.all.js:8886
I.extend.bind @ kendo.all.js:8153
w.extend.applyBinding @ kendo.all.js:9146
I.extend.bind @ kendo.all.js:9096
a @ kendo.all.js:9239
a @ kendo.all.js:9247
a @ kendo.all.js:9247
s @ kendo.all.js:9262
c.extend.refresh @ kendo.all.js:36822
c.extend.init @ kendo.all.js:36731
(anonymous
function
) @ kendo.all.js:2382
b.extend.each @ jquery-1.9.1.min.js:3
b.fn.b.each @ jquery-1.9.1.min.js:3
e.fn.(anonymous
function
) @ kendo.all.js:2381
ue.ui.DataBoundWidget.extend.editCell @ kendo.all.js:45210
(anonymous
function
) @ kendo.all.js:45168
b.event.dispatch @ jquery-1.9.1.min.js:3
v.handle @ jquery-1.9.1.min.js:3
Since 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.