Wijmo FlexSheet

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/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.input.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.grid.filter.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.sheet.min.js"></script>
<div class="container">

 <div id="flexSheet" style="height:350px;"></div>
 </div>

JavaScript

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

var cv = new wijmo.collections.CollectionView(data);

// create the FlexSheet control
var flexSheet = new wijmo.grid.sheet.FlexSheet('#flexSheet');
var sumRow=new wijmo.grid.GroupRow();
flexSheet.addBoundSheet('Bound Sheet', cv);
//set column aggregate
flexSheet.columns.forEach((col)=>{
	col.aggregate=1;
});


function getCurrentData(flex){
	var data=[];
  flex.rows.forEach((row)=>{
  	if(row.isVisible&&row.dataItem){
    	data.push(row.dataItem);
    }
  });
  return data;
}

function setSummaryData(flex,row){
	var data=getCurrentData(flex);
	flex.columns.forEach((col,index)=>{
  if(col.aggregate&&col.dataType==2){
  	var aggData=wijmo.getAggregate(col.aggregate, data, col.binding);
    flex.setCellData(row.index, index, aggData);
  }
  
  });
}

function setSummary(flexsheet){
  setSummaryData(flexSheet,sumRow);
}

flexSheet.cellEditEnded.addHandler((s,e)=>{
	setSummary(flexSheet);
});
flexSheet.filter.filterApplied.addHandler(()=>{
	setSummary(flexSheet);
});
flexSheet.rows.push(sumRow);
setSummary(flexSheet);