Angular Ui-grid - export to excel ui-grid error
<p>good, i am using this code to link <a href="http://brianhann.com/exporting-spreadsheets-from-ui-grid/" rel="nofollow">http://brianhann.com/exporting-spreadsheets-from-ui-grid/</a> export to excel ui-grid from a table, but I skip this mistake, I pass what happens to me.
I error occurs in the code where it says:</p>

<pre><code>$rows.forEach(function (row, ri) {
  ri +=1;
  $scope.gridApi.grid.columns.forEach(function (col, ci) {
    var loc = XLSX.utils.encode_cell({r: ri, c: ci});
    sheet[loc] = {
      v: row[ci].value,
      t: 's'
    };
    endLoc = loc;
  });
</code></pre>

<p>Regards, and thank you very much.</p>

<p>The code of controller is:</p>

<pre><code>$scope.exportXLSX = function(){
var data = [
  [] // header row
];

var rows = uiGridExporterService.getData($scope.gridApi.grid, uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE);

var sheet = {};

$scope.gridApi.grid.columns.forEach(function (col, i) {
  if (col.visible) {
    var loc = XLSX.utils.encode_cell({r: 0, c: i})
    sheet[loc] = {
      v: col.displayName
    };
  }
});

var endLoc;
rows.forEach(function (row, ri) {
  ri +=1;
  $scope.gridApi.grid.columns.forEach(function (col, ci) {
    var loc = XLSX.utils.encode_cell({r: ri, c: ci});
    sheet[loc] = {
      v: row[ci].value,
      t: 's'
    };
    endLoc = loc;
  });
});
sheet['!ref'] = XLSX.utils.encode_range({ s: 'A1', e: endLoc });

var workbook = {
  SheetNames: ['Sheet1'],
  Sheets: {
    Sheet1: sheet
  }
};

var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };
var wbout = XLSX.write(workbook, wopts);

saveAs(new Blob([s2ab(wbout)], {type: ""}), "test.xlsx");
</code></pre>

<p>}; </p>

<p><a href="http://i.stack.imgur.com/a30m2.png" rel="nofollow">error</a></p>