我不知道如何描述细节,你可以在这个视频中看到一个错误: http ://www.youtube.com/watch?v=D6NPd-j2erg&feature= youtu.be 这是我使用的代码:
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/customer/get",
dataType: "json",
type: "POST"
},
update: {
url: "/customer/edit",
dataType: "json",
type: "POST"
},
destroy: {
url: "/customer/delete/",
dataType: "json",
type: "POST"
},
create: {
url: "/customer/add",
dataType: "json",
type: "POST"
}
},
batch: false,
pageSize: 20,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
schema: {
data: "Data",
total: "Total",
model: {
id: "CustomerId",
fields: {
CustomerId: { editable: false, nullable: true },
Name: { validation: { required: true } },
Code: { type: "string", editable: false }
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
height: 430,
filterable: true,
sortable: true,
pageable: {
refresh: true,
pageSizes: [10, 20, 30],
buttonCount: 10
},
toolbar: ["create"],
columns: [
{ field: "Name", title: "Name" },
{ field: "Code", title: "CODE", width: "100px" },
{ command: ["edit", "destroy"], title: " ", width: "200px" }],
editable: "popup"
});
});
我犯了什么错误吗?我添加了以下 Kendo Ui 库:
<script src="/Scripts/kendo/2013.1.319/jquery.min.js"></script>
<script src="/Scripts/kendo/2013.1.319/kendo.all.min.js"></script>
<script src="/Scripts/kendo/2013.1.319/kendo.aspnetmvc.min.js"></script>
<script src="/Scripts/kendo.modernizr.custom.js"></script>