Wijmo 5 - FlexGrid and FlexChart

HTML

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.chart.min.js"></script>
<h1>Hello Wijmo 5!</h1>

<p>This is a <b>FlexGrid</b> control:</p>
<div id="theGrid"></div>

<p>And this is a <b>FlexChart</b> control showing the same data:</p>
<div id="theChart"></div>

CSS

.wj-flexgrid {
  margin: 12px;
}


/* .wj-flexgrid .wj-group:not(.wj-state-active){
  background-color:lightgreen!important;
} */
.custom-footer:not(.wj-state-active){
  background-color:lightgreen!important;
}
.custom-footer .wj-elem-collapse{
  display:none;
}
body {
  margin-bottom: 24pt;
}

JavaScript

onload = function() {

    // create some random data
    var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
        data = [];
    for (var i = 0; i < countries.length; i++) {
        data.push({
            country: countries[i],
            downloads: Math.round(Math.random() * 20000),
            sales: Math.random() * 10000,
            expenses: Math.random() * 5000
        });
    }

    // create CollectionView on the data (so grid and chart stay in sync)
    var view = new wijmo.collections.CollectionView(data);

    // initialize the grid
    var grid = new wijmo.grid.FlexGrid('#theGrid', {
        columns: [
        	{ binding: 'country', header: 'Country' ,aggregate:2},
          { binding: 'sales', header: 'Sales' },
          { binding: 'expenses', header: 'Expenses' },
          { binding: 'downloads', header: 'Downloads', format: 'n0' }
				],
        autoGenerateColumns: false,
        loadedRows:function(s,e){
   	     var fRow=new wijmo.grid.GroupRow();
   fRow.cssClass="custom-footer";
  s.rows.splice(0,0,fRow);
  s.setCellData(0,0,'Cnt: '+getColumnAggregate(s.columns[0],s))
        },
        itemsSource: view,
        selectionMode: wijmo.grid.SelectionMode.Row
    });
   
}

function getColumnAggregate(column, grid){
	return wijmo.getAggregate(column.aggregate,grid.collectionView.items,column.binding)
}