【问题标题】:Tabulator not downloading using Tabulator.downloadTabulator 未使用 Tabulator.download 下载
【发布时间】:2019-06-21 05:46:43
【问题描述】:

Tabulator 未使用 Tabulator.download() 下载。我尝试过使用 CSV 和 xlsx 格式,但没有成功。我在反应组件中使用 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)

【问题讨论】:

  • 请贴出您正在调用的下载功能的代码

标签: download tabulator


【解决方案1】:

原来这是一个特定于制表器反应版本的问题。在这里找到了解决方案:

https://github.com/ngduc/react-tabulator/issues/76

只需将其添加到您的选项对象中:

options  = {
    downloadDataFormatter: (data) => data,
    downloadReady: (fileContents, blob) => blob,
}

【讨论】:

  • 你也可以将它定义为 React 组件的属性 (ref = ref)} columns={columns} data={data} options={options } downloadDataFormatter={data => data} downloadReady={(fileContents, blob) => blob} rowClick={this.handleRowClick} />
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-02-26
  • 2015-12-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多