给定以下代码:
<script type="text/javascript">
$(document).ready(function () {
dataSource = new kendo.data.DataSource({
transport: {
read: {
//url:crudurl+"/GetData",
url: "GridWebService.asmx/GetData",
dataType: "json"
}
},
batch: true,
pageSize: 4,
schema: {
model: {
id: "eid",
fields: {
eid: { editable: false, nullable: true },
ename: { validation: { required: true} },
age: { type: "number", validation: { required: true, min: 1} },
salary: { type: "number", validation: { required: true, min: 1} }
}
}
}
});
$("#grdCRUD").kendoGrid({
dataSource: dataSource,
pageSize: 4,
pageable: {
refresh: true,
pageSizes: true
},
height: 400,
toolbar: ["create"],
columns: [
{ field: "ename", title: "EmployeeName", width: "150px" },
{ field: "age", title: "EmployeeAge", width: "150px" },
{ field: "salary", title: "EmployeeSalary", width: "100px" },
{ command: ["edit", "destroy"], title: " ", width: "210px" }
],
editable: "inline"
});
});
</script>
在这里,我编写了上面的代码行,用于Grid
通过 Web 服务将数据库中的数据绑定到剑道。但是,Data
不绑定到Grid
. 中是否有任何错误DataSource
。确保我没有使用 Ajax 绑定。