KendoUi学习之旅 Grid的使用

<!DOCTYPE html>
<html>
<head>

</head>
<body>
<div id="example">
<div class="demo-section k-content wide">
<div>
<div data-role="grid"
data-auto-bind="true"
data-editable="true"
data-toolbar="['create', 'save']"
data-columns="[
{ 'field': 'ID', 'width': 270 },
{ 'field': 'Price' },
]"
data-bind="source: products,
visible: isVisible,
events: {
save: onSave
}"
style="height: 200px"></div>
</div>
</div>
<script>
var viewModel = kendo.observable({
isVisible: true,
products: new kendo.data.DataSource({
schema: {
model: {
id: "ID",
fields: {
ID: { type: "number" },
Price: { type: "string" }
}
}
},
batch: true,
transport: {
read: {
url: '/Home/GetCategoryList',
dataType: "json"
},

}
})
});
kendo.bind($("#example"), viewModel);
</script>
</div>
</body>
</html>

原文地址:https://www.cnblogs.com/jiangcm/p/7456548.html