试试下面的例子:
$("#SearchDetails").kendoGrid({
scrollable: true,
resizable: true,
sortable: true,
pageable: false,
navigatable: true,
filterable: false,
groupable: true,
selectable: "row",
schema: {
fields: {
Duration: { type: "number" }
}
},
columns: [
{ title: ' Name', field: 'CustName'},
{ title: ' Event Name', field: 'ServiceName'},
{ title: 'Resource Name', field: 'ResourceName', footerTemplate: '<span style=\'float:right;\'>Total</span>' },
{ title: 'Duration(Min)', field: 'Duration', template: '<span style=\'float:right;\'>#=Duration#</span>', aggregates: 'sum', footerTemplate: '<span id=\'footerPlaceholder\' style=\'float:right;font-weight: bold;\'>#=calc(sum)#</span>' },
{ title: 'Total Amount (' + currencySymbol + ')', field: 'TotalAmount', template: '<span style=\'float:right;\'>#=TotalAmount#</span>', aggregates: 'sum', footerTemplate: '<span style=\'float:right;font-weight: bold;\'>#=kendo.toString(sum,\'n\')#</span>' }
],
dataSource: {
data: viewModel.AppintDetails(),
aggregate: [{ field: 'Duration', aggregate: 'sum', format: 'n' }, { field: 'TotalAmount', aggregate: 'sum', format: 'n' }]
}
});
下面我们在 html 部分创建了一个函数
<script type="text/javascript">
function calc(val) {
var hour = Math.floor(val / 60);
var min = val % 60;
val = hour + ":" + min + " hrs";
return val;
}
</script>
我只是用于以正确的日期格式显示持续时间总计。此代码对我有用...在网格下方显示此...详细信息