Posted 14 September 2017, 11:30 am EST
Hello,
FlexGrid cannot add new rows when you are pasting multiple rows while selecting a cell in the last row. As a workaround you can handle the pasting event of FlexGrid and add new rows to FlexGrid so as to copy paste the data by adding new rows to FlexGrid. Here is the sample code:
[js]
$scope.pasting = function (s, e) {
var pastedText;
console.log(“pasting”);
if (e.row == $scope.flex.rows.length - 1) {
pastedText = window.clipboardData.getData(‘Text’);
if (pastedText.split(“\n”).length > 1) {
for (var i = 0; i < pastedText.split("\n").length - 2; i++) {
$scope.flex.collectionView.addNew();
$scope.flex.collectionView.commitNew();
}
}
}
$scope.flex.select(e.row, e.col);
}
[/js]
If you copy four rows from Excel and perform the paste operation by selecting the first cell in the last row, then it adds three new rows to FlexGrid and hence pastes four rows into FlexGrid.
Hope it helps.
Thanks,
Manpreet Kaur
2016/02/New_Paste.html