I am trying to databind ASP.NET web api odata v3 to kendoui diagram
control. It works OK with local data source but I am getting error when
trying to use odata
Error:
Uncaught TypeError: Cannot read property '__count' of undefined
HTML
AngularJS
$scope.options = {
dataSource: {
type: "odata",
transport: {
read: {
url: "odata/Entities",
dataType: "json",
type: "GET"
}
}
},
shapeDefaults: {
visual: visualTemplate
},
layout: {
type: "tree"
},
schema: {
data: "value"
}
};
function visualTemplate(options) {
var dataviz = kendo.dataviz;
var g = new dataviz.diagram.Group();
var dataItem = options.dataItem;
g.append(new dataviz.diagram.Rectangle({
width: 210,
height: 75,
stroke: {
width: 0
},
fill: "green"
}));
g.append(new dataviz.diagram.TextBlock({
text: dataItem.Name,
x: 85,
y: 20,
color: "#fff"
}));
return g;
}
json
{
"odata.metadata":"http://localhost/TestSPA/odata/$metadata#Entities","odata.count":"5","value":[
{
"EntityRef":7,"Name":"Test"
}
]
}
control. It works OK with local data source but I am getting error when
trying to use odata
Error:
Uncaught TypeError: Cannot read property '__count' of undefined
HTML
<
div
kendo-diagram
=
"diagram"
k-options
=
"options"
/>
AngularJS
$scope.options = {
dataSource: {
type: "odata",
transport: {
read: {
url: "odata/Entities",
dataType: "json",
type: "GET"
}
}
},
shapeDefaults: {
visual: visualTemplate
},
layout: {
type: "tree"
},
schema: {
data: "value"
}
};
function visualTemplate(options) {
var dataviz = kendo.dataviz;
var g = new dataviz.diagram.Group();
var dataItem = options.dataItem;
g.append(new dataviz.diagram.Rectangle({
width: 210,
height: 75,
stroke: {
width: 0
},
fill: "green"
}));
g.append(new dataviz.diagram.TextBlock({
text: dataItem.Name,
x: 85,
y: 20,
color: "#fff"
}));
return g;
}
json
{
"odata.metadata":"http://localhost/TestSPA/odata/$metadata#Entities","odata.count":"5","value":[
{
"EntityRef":7,"Name":"Test"
}
]
}