I'm having a problem getting my grid to bind to some json data. I've searched the forums for a solution but no luck.
The following code throws an error of 'Unable to get value of property 'length': object is null...':
Based on some other forum posts, this is indicative of a bad json response so i copied and pasted the json from the response to a javascript variable and it works so I'm not sure what I'm doing wrong.
This works:
I've validated my response by other means and it is valid json so I'm not sure what to try next. Something is "wrong" with it but I don't know what.
here is the raw response:
Thanks in advance
Any ideas?
The following code throws an error of 'Unable to get value of property 'length': object is null...':
$(
"#search-grid"
).kendoGrid({
dataSource: {
transport: {
read: {
url:
"a URL"
}
},
schema: {
data:
"data"
}
},
columns: [{field:
"Name"
,title:
"Name"
}]
});
This works:
var
testdata = { "data": [{
"Name"
:
"TestY"
}] };
var
searchViewModel = kendo.observable({
init:
function
() {
$(
"#search-grid"
).kendoGrid({
dataSource: {
data: testdata,
/*
transport: {
read: {
url: "a URL"
}
},
*/
schema: {
data:
"data"
}
},
columns: [{field:
"Name"
,title:
"Name"
}]
});
}
I've validated my response by other means and it is valid json so I'm not sure what to try next. Something is "wrong" with it but I don't know what.
here is the raw response:
HTTP/1.1 200 OK
Content-Length: 27
Content-Type: application/JSON
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Fri, 07 Jun 2013 20:00:59 GMT
{"data":[{"Name":"TestY"}]}
Thanks in advance
Any ideas?