【发布时间】:2019-03-25 12:34:05
【问题描述】:
我是 JavaScript 和 Tabulator 的新手,我被困在这个地方,感谢您的帮助。
我已将数据加载到制表器表上并对其进行了一些更改(添加新列、删除列等),这些更改会反映在表上,但是当我使用 table.getData() 时更新的数据不会反映(反映旧数据)。我需要这个来使用其他一些地方。我哪里错了?
这里是示例代码。
tabulatorTable = new Tabulator("#dfTable", {
selectable:true,
data:dataJson,
layout:"fitColumns", //fit columns to width of table
responsiveLayout:"hide", //hide columns that dont fit on the table
tooltips:true, //show tool tips on cells
addRowPos:"top", //when adding a new row, add it to the top of
//table
history:true, //allow undo and redo actions on the table
pagination:"local", //paginate the data
paginationSize:20,
movableColumns:true, //allow column order to be changed
resizableRows:true, //allow row order to be changed
columns:[
{title:"YearsExperience", field:"YearsExperience", editor:"number"},
{title:"Salary", field:"Salary", sorter:"number"}
]
});
tabulatorTable.addColumn({formatter:"rownum", title:"id"}); **// Adding new column to the table**
console.log(tabulatorTable.getData()); **// Does not reflect the newly added column**
预期的 Json 文件包含添加的列数据(标题 - “id”)
【问题讨论】:
标签: javascript tabulator