未使用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)发布于 2019-06-21 05:46:44
事实证明,这是一个特定于react版本的tabulator的问题。在这里找到了一个解决方案:
https://github.com/ngduc/react-tabulator/issues/76
只需将此代码添加到您的options对象中:
options = {
downloadDataFormatter: (data) => data,
downloadReady: (fileContents, blob) => blob,
}https://stackoverflow.com/questions/53622809
复制相似问题