I want to select a row in angular-ui grid and copy the row to clip board.
This is my code:
$scope.copySelection = function() {
$scope.retainSelection = $scope.gridApi.selection.getSelectedRows();
alert(JSON.stringify($scope.retainSelection));
var input = document.createElement("input");
input.type = "text";
document.getElementsByTagName('body')[0].appendChild(input);
input.value = JSON.stringify($scope.retainSelection);
input.select();
document.execCommand("copy");
input.hidden = true;
$scope.gridApi.selection.clearSelectedRows();
};
Plunker: http://plnkr.co/edit/dcj7DUWHyA3u1bouxRhI?p=preview
However, I just want to copy the visible columns, but I am getting all the columns which are in the JSON. I dont want the hidden columns. How do I do that? Please help.