首页 > 解决方案 > Ag-Grid:无法读取属性 0

问题描述

我收到Uncaught TypeError: Cannot read property '0' of undefined尝试将 ag-grid 数据导出到 Excel 中。任何想法可能是什么原因。它在镀铬线上有喙@_gridOptions.api.getDataAsExce

_exportDataAsExcel: ->
   content = @_gridOptions.api.getDataAsExcel({allColumns: false, exportMode: "xml", suppressTextAsCDATA: true})
workbook = XLSX.read(content, type: 'binary')
xlsxContent = XLSX.write(workbook, bookType: 'xlsx', type: 'base64')
@_downloadXLSX(xlsxContent)


_downloadXLSX: (base64content) ->
fileName = 'export.xlsx'
blobObject = @_base64toBlob(
  base64content,
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
)

错误画面

标签: javascriptjquerycoffeescriptag-gridag-grid-angular

解决方案


推荐阅读