![](/img/trans.png)
[英]How to change column title in table that was created by tabulator.js?
[英]Tabulator.js table.getRows() returning array of strings instead of RowComponents
我在我的代码中这样做:
let rows = table.getRows(); //as indicated per https://tabulator.info/docs/5.4/update
for (const row in rows) {
console.log(row);
}
我的表中有三行,我的 output 是:
0
1
2
更改console.log(row);
console.log(typeof row);
我发现getRows()
返回的是一个字符串数组,而不是 RowComponents。 知道会发生什么吗?
你想用
for (const row of rows) { ...
代替
for (const row in rows) { ...
for in
将迭代 object 的属性,而for of
将迭代值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.