$.ajax({
type: "POST",
url: "EmpService.asmx/GetEmployeeDetails",
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (
$("#grid").kendoGrid({
dataSource: {
data: result.d
},
schema:{
data: "d"
},
columns: [{
field: "EMP_NAME",
title: "First Name"
},
{
field: "EMP_ID",
title: "ID"
}],
});
},
error: function (r) {
alert(r.responseText);
},
failure: function (r) {
alert(r.responseText);
}
});
});
我使用ajax调用调用服务并返回一个json数据,我试图绑定到它的Kendo网格,但它没有绑定。我有以下格式从服务返回的json数据
[{"EMP_NAME":"E1","EMP_ID":1},{"EMP_NAME":"E2","EMP_ID":2},{"EMP_NAME":"E3","EMP_ID":3}]
但是当我尝试以下面的编码方式时,网格会显示细节
dataSource: {
data: [{"EMP_NAME":"E1","EMP_ID":1},{"EMP_NAME":"E2","EMP_ID":2},{"EMP_NAME":"E3","EMP_ID":3}]
},
答案 0 :(得分:0)
尝试在dataSource中指定架构,如下所示。
dataSource: {
data: gridData,
schema: {
model: model
},
pageSize: 10
},