简体   繁体   中英

Tabulator.js table.getRows() returning array of strings instead of RowComponents

I'm doing this in my code:

let rows = table.getRows(); //as indicated per https://tabulator.info/docs/5.4/update
for (const row in rows) {
  console.log(row);
}

There are three rows in my table and my output is:

0
1
2

Changing console.log(row); to console.log(typeof row); I found that getRows() is returning an array of strings instead of RowComponents. Any idea what could be going on?

You want to use

for (const row of rows) { ...

instead of

for (const row in rows) { ...

for in will iterate over the properties of an object whereas for of will iterate the values .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM