EditItem on buttonClick

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>
<button id="btn">
Edit Item
</button>

JavaScript

var view=[];
var data = [];
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');




onload = function() {

    // create some random 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)
     view = new wijmo.collections.CollectionView(data);
view.trackChanges=true;
    // initialize the grid
    var grid = new wijmo.grid.FlexGrid('#theGrid', {
        columns: [
        	{ binding: 'country', header: 'Country' },
          { binding: 'sales', header: 'Sales' },
          { binding: 'expenses', header: 'Expenses' },
          { binding: 'downloads', header: 'Downloads', format: 'n0' }
				],
        autoGenerateColumns: false,
        itemsSource: view,
        selectionMode: wijmo.grid.SelectionMode.Row
    });
document.getElementById('btn').onclick=function(){
var item=view.currentItem;
view.editItem(item);
view.currentEditItem.country='WW';
view.commitEdit();
alert(view.itemsEdited.length);

}

}