<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.mobile.all.min.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script></head>
<body>
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "name",
title: "姓名",
footerTemplate: "合计",
},
{ field: "sex" ,
title: "性别",
footerTemplate: "<span style='float:right'>#= count #</span>",
},
{ field: "age",
title:"年龄",
attributes: { style: "text-align: right;" },
footerTemplate: "<span style='float:right'>#=kendo.toString(sum,'N0') #</span>",
},
{ field: "weight",
title: "体重",
attributes: { style: "text-align: right;" }, format: "{0:n}",
footerTemplate: "<span style='float:right'>#= kendo.toString(average,'N2') #</span>",
},
{ command: "destroy",
title:"删除"}
],
dataSource: {
data: [
{ name: "乔峰", sex: "男", age: 36, weight: 75.50 },
{ name: "赵敏", sex: "女", age: 25, weight: 45.00 }
],
aggregate: [
{ field: "sex", aggregate: "count" },
{ field: "age", aggregate: "sum"},
{ field: "weight", aggregate: "average"}
]
},
editable: {
confirmation: true,
cancelDelete: "No"
}
});
</script>
</body>
</html>
网友评论