JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdn.kendostatic.com/2012.2.621/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.621/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.621/styles/kendo.default.min.css">
<div id="grid"></div>
CSS
#display {
width: 50%;
margin: 0 auto;
padding: 10px;
border: 1px solid blue;
}
JavaScript
var dataRecords = [{foo:1, bar: 1}, {foo:3, bar: 5}];
var emptyData = [];
var ds = new kendo.data.DataSource({
//data: dataRecords,
data: dataRecords , //sum is undefined when no records
schema: {
model: {
fields: {
foo: {type: "number"},
bar: {type: "number"}
}
}
},
aggregate: [
{field: 'foo', aggregate: 'sum'},
{field: 'bar', aggregate: 'sum'}
]
});
$("#grid").kendoGrid({
dataSource: ds,
columns: [
{
field: "foo",
footerTemplate: function(agg){
return "Total: " + agg.foo.sum;
}
},
{
field: "bar",
footerTemplate: "count:#= typeof sum != 'undefined' ? sum : 0 #"
}
]
});