Hi All,
I am getting this error.
Cannot read property '__count' of undefined
I have read up on this and the solution was to make sure that this statement is part of the model.
total: function (data) {
return data["odata.count"];
},
Fiddler returns the correct information
"odata.metadata":"<url>/%24metadata#categories","odata.count":"1","value":[
{
"SubCategories":[
{
"Id":1,"Name":"Skateboards","CategoryId":1,"Tracking":{
"CreatedBy":"tester","CreatedOn":"2013-07-29T14:48:25.987","ModifiedBy":"tester","ModifiedOn":"2013-07-29T14:48:25.987","Timestamp":"AAAAAAAACAk="
}
}
],"Id":1,"Name":"Sports","Tracking":{
"CreatedBy":"tester","CreatedOn":"2013-07-29T14:48:25.987","ModifiedBy":"tester","ModifiedOn":"2013-07-29T14:48:25.987","Timestamp":"AAAAAAAACAY="
}
}
Here is the data source configuration.
new kendo.data.HierarchicalDataSource({
type: "odata",
transport: {
read: {
url: resourceurl + "/categories",
data: {
$expand:"SubCategories"
},
dataType: "json"
}
},
schema: {
model: {
id: "Id",
hasChildren: true,
children: "SubCategories",
data: function (data) {
if (data.value) {
return data.value;
}
delete data["odata.metadata"];
return [data];
},
total: function (data) {
return data["odata.count"];
},
errors: function (data) {
}
}
}
});
Any ideas?
Regards
Richard...
I am getting this error.
Cannot read property '__count' of undefined
I have read up on this and the solution was to make sure that this statement is part of the model.
total: function (data) {
return data["odata.count"];
},
Fiddler returns the correct information
"odata.metadata":"<url>/%24metadata#categories","odata.count":"1","value":[
{
"SubCategories":[
{
"Id":1,"Name":"Skateboards","CategoryId":1,"Tracking":{
"CreatedBy":"tester","CreatedOn":"2013-07-29T14:48:25.987","ModifiedBy":"tester","ModifiedOn":"2013-07-29T14:48:25.987","Timestamp":"AAAAAAAACAk="
}
}
],"Id":1,"Name":"Sports","Tracking":{
"CreatedBy":"tester","CreatedOn":"2013-07-29T14:48:25.987","ModifiedBy":"tester","ModifiedOn":"2013-07-29T14:48:25.987","Timestamp":"AAAAAAAACAY="
}
}
Here is the data source configuration.
new kendo.data.HierarchicalDataSource({
type: "odata",
transport: {
read: {
url: resourceurl + "/categories",
data: {
$expand:"SubCategories"
},
dataType: "json"
}
},
schema: {
model: {
id: "Id",
hasChildren: true,
children: "SubCategories",
data: function (data) {
if (data.value) {
return data.value;
}
delete data["odata.metadata"];
return [data];
},
total: function (data) {
return data["odata.count"];
},
errors: function (data) {
}
}
}
});
Any ideas?
Regards
Richard...