Kendo Datasource를 사용하여 원격 서비스 (WebAPI)에서 검도 그리드로 데이터를 바인딩하려는 시도에 대한 이해를 돕는 데 도움이되었습니다. Chrome에서 개발자 도구를 사용할 때 서비스가 호출되고 json 데이터가 반환됨을 알 수 있습니다. 문제는 데이터가 그리드에 렌더링되지 않는다는 것입니다. 페이지가 웹 서비스를 호출로드하고 검색된 JSON (나는 다른에 사이트 및 서비스 이후 JSONP를하는 사용하는 경우Kendo Grid to Web API
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="css/kendo.common.min.css" rel="stylesheet" />
<link href="css/kendo.default.min.css" rel="stylesheet" />
<script src="lib/jquery.min.js"></script>
<script src="lib/kendo.web.min.js"></script>
</head>
<body>
<div id="reportGrid"></div>
<script>
$(document).ready(function()
{
// Report datasource
var reportsDataSource = new kendo.data.DataSource({
// Transport
transport: {
read: {
url: "http://localhost:54363/api/report",
dataType: "jsonp",
jsonpCallback: "reportCallback"
}
},
// Schema
schema: {
model: {
fields: {
SerialNumber: { type: "string" },
Version: { type: "number" },
DateReceived: { type: "date" },
Title: { type: "string" }
}
}
}
});
$("#reportGrid").kendoGrid(
{
dataSource: reportsDataSource
});
});
</script>
</body>
</html>
:
여기 그냥 그리드를 포함하는 매우 간단한 페이지의 HTML입니다 도메인). 서비스가 호출되고 다음 JSON이 검색됩니다 (Chrome에서 응답을 검토하여이 정보를 얻을 수 있습니다).
[{"SerialNumber":"1","Version":2,"DateReceived":"2013-08-01T16:01:12.5828003+01:00",...
그리드가 채워지지 않은 이유를 정말로 이해하지 못합니다.
반품 모양은 어떻습니까? JSON 객체로 다시 돌아올 것이고 인식 할 수없는 문자열 일 것입니다. – AntSpiteri
예, 제대로 포맷 된 json을 반환합니다. 데이터 소스에서 예상대로 서비스를 호출했지만 그리드를 채우지 않습니다. – jongillster
JSON을 게시 할 수 있습니까? – AntSpiteri