制表器无法使用Tabulator.download()下载。我尝试使用CSV以及xlsx格式,但是没有成功。我在react组件中使用npm包。数据在UI的表格中可见。
它在以下功能上失败:
Download.prototype.downloaders = {
csv: function csv(columns, data, options, setFileContents, config)
控制台中显示的堆栈跟踪为:
Cannot read property 'forEach' of undefined
at parseRows (tabulator.js:11677)
at Download.csv (tabulator.js:11722)
at Download.download (tabulator.js:11419)
at Tabulator.download (tabulator.js:8337)
答案 0 :(得分:0)
原来,这是制表器的反应版本特有的问题。在这里找到解决方案:
https://github.com/ngduc/react-tabulator/issues/76
只需将其添加到您的选项对象中即可:
options = {
downloadDataFormatter: (data) => data,
downloadReady: (fileContents, blob) => blob,
}