我正在尝试将KendoUI(没有服务器包装器)集成到我的ASP.NET MVC应用程序中:
这是HTML文件(仅必需的代码):
<div id="example" class="k-content">
<div id="clientsDb">
<div id="grid" style="height: 380px"></div>
</div>
<script>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type : "json",
transport : {
read : {
url : "data.json",
type : "POST",
dataType: "json"
},
contentType: "application/json"
},
schema : {
data : "data",
total: "total"
},
pageSize : 10,
serverPaging : true,
serverFiltering: true,
serverSorting : true
},
height : 430,
groupable : false,
sortable : false,
pageable : true,
columns : [
{
field: "PageUrl",
title: "PageUrl",
width: 140
},
{
field: "Id",
title: "Id",
width: 190
}
]
});
});
</script>
</div>
这是“ MyContollerName”的“ ActionMethodName”方法返回的JSON结果:
{
"Data" : [
{ "Id" : 30, "PageUrl": "http://www.someurl.com" },
{ "Id" : 29, "PageUrl": "http://www.someurl.com/" },
{ "Id" : 26, "PageUrl": "http://www.someurl.com" }
],
"Total": 10
}
但是什么也没有渲染(网格没有渲染,结果没有渲染)。获取无限呈现的“正在加载”图标。有人可以帮忙吗?
我还收到以下JS错误:“ TypeError:无法调用未定义/Scripts/kendo/2013.3.1119/kendo.web.min.js:13的方法'slice'”
在模式中,您定义了数据data
以大写形式返回时称为(小写)。
将架构更改为:
schema : {
data : "Data",
total: "total"
},
它会工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句