I am not sure how I should map this data to get it to the datasource. I have read the docs but am not sure how to map this data. If I change the url back to the demo.kedoui.com/service the data: event fires and binds ok. With my url I get error event with msg error, but I do not see any data returned or how to fix this so the data is mapped correctly and the data event fires using my url json service.
Thanks
Data:
Code:
Thanks
Data:
{
"__entityModel"
:
"People"
,
"__COUNT"
:3,
"__SENT"
:3,
"__FIRST"
:0,
"__ENTITIES"
:[{
"__KEY"
:
"27"
,
"__STAMP"
:11,
"ID"
:27,
"firstName"
:
"dan"
,
"lastName"
:
"qqqq"
},{
"__KEY"
:
"26"
,
"__STAMP"
:14,
"ID"
:26,
"firstName"
:
"dan"
,
"lastName"
:
"rrrr"
},{
"__KEY"
:
"25"
,
"__STAMP"
:13,
"ID"
:25,
"firstName"
:
"dan"
,
"lastName"
:
"eeee"
}]}
$(document).ready(
function
() {
//var crudServiceBaseUrl = "http://demos.kendoui.com/service",
// var crudServiceBaseUrl = "http://127.0.0.1:8081/rest",
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"http://127.0.0.1:8081/rest/People"
,
type:
"POST"
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
}
},
schema: {
data:
function
(data) {
alert(
"got data"
)
alert(data);
/*Data Return Successfully*/
return
data;
}
},
error:
function
(e) {
debugger;
alert(
"Error"
);
},
change:
function
(e) {
alert(
"Change"
);
},
requestStart:
function
(e) {
debugger;
alert(
"Request Start"
);
}
});
$(
"#grid"
).kendoGrid({
dataSource: dataSource,
pageable:
true
,
height: 400,
toolbar: [
"create"
],
columns: [
"firstName"
,
"lastName"
,
{ command: [
"edit"
,
"destroy"
], title:
" "
, width:
"210px"
}],
editable:
"inline"
});
});