如何更改由 tabulator.js 创建的 table 中的列标题?

How to change column title in table that was created by tabulator.js?

我使用最新版本的 tabulator.js,我需要能够更改已存在的表中的列标题。有什么想法吗?

谢谢!

列一经创建便无法更改,但您可以删除现有列并将其替换为具有更新定义的另一列:

删除现有列:

table.deleteColumn("fieldName");

添加列:

table.addColumn({title:"Age", field:"age"});

可以在 Column Definition Documentation

中找到更多详细信息

我的黑客工作解决方法

在列定义中声明元素。

title: "<myTitle>Title</myTitle>",

改成这样:

document.getElementsByTagName("myTitle")[0].innerHTML = "myNewTitle";