Wijmo 5 [Flex Grid]

Pasted row in row template and get item added

by Manish Gupta

HTML

<script src="http://cdn.wijmo.com/5.20161.164/controls/wijmo.min.js"></script>
<link rel="stylesheet" href="http://cdn.wijmo.com/5.20161.164/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.20161.164/controls/wijmo.grid.min.js"></script>
<div id="grid"></div>
<p id="output">

</p>

JavaScript

var itemsSource = new wijmo.collections.CollectionView([{
    Name: "Test1",
    Country: "DE",
    CountryCode: "DE"
}, {
    Name: "Test2",
    Country: "DE",
    CountryCode: "DE"
}, {
    Name: "Test3",
    Country: "DK",
    CountryCode: "DK"
}, {
    Name: "Test4",
    Country: "DK",
    CountryCode: "DK"
}]);

var grid = new wijmo.grid.FlexGrid(document.getElementById("grid"), {
    itemsSource: itemsSource,
    allowAddNew: true,
});
 grid.pasted.addHandler(function (s, e) {
            grid.collectionView.commitNew();
        });
itemsSource.trackChanges = true;
itemsSource.collectionChanged.addHandler(function() {
	$("#output").text("Added: " + itemsSource.itemsAdded.length + " Edited: " + itemsSource.itemsEdited.length);
});