Kendo ui 剑道UI网格可排序(和其他属性)不工作

Kendo ui 剑道UI网格可排序(和其他属性)不工作,kendo-ui,Kendo Ui,我正在尝试配置剑道网格,在尝试添加属性(如排序、分组等)时遇到问题。网格在我添加属性之前工作,然后它不会显示任何数据。我看过剑道网站上的文档,看起来好像我和他们的一样,但很明显我有点不对劲 以下是视图: @model ExampleKendoUI.Models.HeaderVm @{ ViewBag.Title = "Index"; } <h2>Index</h2> <div>@Model.Name</div> @section scripts

我正在尝试配置剑道网格,在尝试添加属性(如排序、分组等)时遇到问题。网格在我添加属性之前工作,然后它不会显示任何数据。我看过剑道网站上的文档,看起来好像我和他们的一样,但很明显我有点不对劲

以下是视图:

@model ExampleKendoUI.Models.HeaderVm
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>

<div>@Model.Name</div>

@section scripts {
<script>
  // Output the data as JSON
  var podata = @Html.Raw(Json.Encode(ViewBag.LineItems));
</script>

<div id="poGrid" class="k-content">  

<script> 
     $(document).ready(function () {

    $("#poGrid").kendoGrid({
        dataSource: {
            data: podata
        }, 
          // sortable:true, *** Uncommenting this will break the grid ***   
columns: [
  {
    field: "Description",
    title: "Desc"
  },
  {
    field: "Quantity",
    title: "Quantity"
  }
]

});
});   
</script>    
</div>
}
@model ExampleKendoUI.Models.HeaderVm
@{
ViewBag.Title=“Index”;
}
指数
@型号.名称
@节脚本{
//将数据输出为JSON
var podata=@Html.Raw(Json.Encode(ViewBag.LineItems));
$(文档).ready(函数(){
$(“#poGrid”).kendoGrid({
数据源:{
资料来源:podata
}, 
//可排序:true,***取消注释将打破网格***
栏目:[
{
字段:“说明”,
标题:“描述”
},
{
字段:“数量”,
标题:“数量”
}
]
});
});   
}
这是控制器:

namespace ExampleKendoUI.Controllers
{
public class SampleController : Controller
{
//
// GET: /Sample/

public ActionResult Index(int id)
{
  var header = new HeaderVm()
  {
    Id = id,
    Name = "Req ID"
  };


 var results = new List<PoLineVm>()
  {
    new PoLineVm() 
    {
      Id = 1,
      Description = "Some Product",
      Quantity = 1.5
    },
    new PoLineVm() 
    {
      Id = 2,
      Description = "Another Product",
      Quantity = 4.0
    },
    new PoLineVm() 
    {
      Id = 3,
      Description = "Last Product",
      Quantity = 20
    },
  };

  ViewBag.LineItems = results;

  return View(header);
  }}}
名称空间示例kendoui.Controllers
{
公共类SampleController:控制器
{
//
//获取:/Sample/
公共行动结果索引(int id)
{
var header=new HeaderVm()
{
Id=Id,
Name=“请求ID”
};
var results=新列表()
{
新PoLineVm()
{
Id=1,
Description=“某些产品”,
数量=1.5
},
新PoLineVm()
{
Id=2,
Description=“其他产品”,
数量=4.0
},
新PoLineVm()
{
Id=3,
Description=“最后一个产品”,
数量=20
},
};
ViewBag.LineItems=结果;
返回视图(标题);
}}}
以下是_布局:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
<link href="~/Content/kendo/2012.3.1114/kendo.default.min.css" rel="stylesheet" />
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
@RenderBody()

@Scripts.Render("~/bundles/jquery")
<script src="/scripts/kendo/2012.3.1114/kendo.core.min.js"></script>
<script src="~/Scripts/kendo/2012.3.1114/kendo.data.min.js"></script>
<script src="~/Scripts/kendo/2012.3.1114/kendo.grid.min.js"></script>
@RenderSection("scripts", required: false)
</body>
</html>

@视图包。标题
@style.Render(“~/Content/css”)
@Scripts.Render(“~/bundles/modernizer”)
@RenderBody()
@Scripts.Render(“~/bundles/jquery”)
@RenderSection(“脚本”,必需:false)

您没有包含所需的JavaScript文件,JavaScript错误意味着缺少kendoSortable。查看所需JavaScript文件的文档:

您是否检查了控制台中的JavaScript错误?我确实了解到了这一点,但我不确定它是否有帮助:e(…).attr(…).kendoSortable不是函数谢谢,就是这样,我一直在使用别人给我的一个简化示例,并假设引用了所有必需的脚本文件。一旦我添加了kendo.sortable.js,它就工作得很好。