【发布时间】:2018-11-27 18:47:55
【问题描述】:
我正在使用 Tabulator 来管理一些表格,我已经了解了如何以 JSON 格式和其他格式下载文件,但我想知道是否包含将数据保存在 JSON 对象中的函数,以便我可以将其直接上传到服务器
我已经检查了这个页面http://tabulator.info/docs/4.1/download 并且我想到了使用“自定义文件格式化程序”然后拦截下载 bolb 但我一直收到错误提示
setFileContents(names.join(", "), "text/plain");
Uncaught ReferenceError: setFileContents is not defined
功能代码:
document.querySelector("#uploadJSON").onclick = function(){
var fileFormatter = function(columns, data, options){
var names = [];
data.forEach(function(row){
names.push(row.name);
});
setFileContents(names.join(", "), "text/plain");
}
table.download(fileFormatter, "test.json");
}
【问题讨论】:
标签: javascript tabulator