You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Tabulator启用可移动行手柄后数据导入导出异常问题求助

Tabulator启用可移动行手柄后数据导入导出异常问题求助

我目前在用Tabulator的table.download导出数据、table.import导入数据到表格,原本一切正常,直到我开启了以下配置:

moveableRows: true,
rowHeader:{headerSort:false, rowHandle: true, formatter:"handle"},

只有当我通过formatter: "handle"显示出行手柄,并且尝试导入CSV时才会出问题。如果不用手柄只开启行移动功能的话一切正常,但我很喜欢行左侧显示的手柄样式,看起来就是这个手柄配置导致读取CSV时出现了错误——导入后每行的第一个字段都丢失了。

有没有大佬能给点解决思路?

我的完整配置代码如下:

var tableCues = new Tabulator("#cueTable", {
    rowHeight: 30,
    movableRows: true,
    rowHeader:{headerSort:false, resizable: false, minWidth:30, width:30, rowHandle:true, formatter:"handle"},
    selectableRows: true,
    placeholder: "Awaiting Data, Please Load File",
    columns: [
        { title: "Name", field: "name", width: 150, editor:"input" },
        { title: "Item", field: "item", editor:"input"},
        { title: "ABS Move", field: "absmove", editor:"input"},
        { title: "Speed", field: "speed", editor: "input"},
        { title: "Accel", field: "accell", editor: "input"},
        { title: "Decel", field: "decel", editor: "input"},
        { title: "Position", field: "posnow", editor: "input"},
        { title: "Progress", field: "progress", formatter: "progress", sorter: "number" },
        { title: "Done", field: "car", hozAlign: "center", editor: true, formatter:
            "tickCross", formatterParams: { crossElement: false },
            headerSort: false, editable: true },
        { formatter:"buttonCross", align:"center", title:"del", headerSort:false, cellClick:function(e, cell){
            if(confirm('Are you sure you want to delete this entry?'))
            cell.getRow().delete();
            }
        }
    ],
});

//trigger download of data.csv file
document.getElementById("download-csv").addEventListener("click", function(){
    tableCues.download("csv", "data.csv");
});

//trigger AJAX load on "Load Data via AJAX" button click
document.getElementById("file-load-trigger").addEventListener("click", function () {
    tableCues.import("csv", "buffer");
});

更新:我发现如果让CSV每行开头多一个空字段(两个引号加逗号),或者设置autoColumns: true(但这样会丢失其他格式配置),CSV就能正常加载了。现在我打算找找怎么让table.download导出的时候自动加上这个额外的空字段...

备注:内容来源于stack exchange,提问作者David Banning

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 14:15:29