You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first column in the table will be labeled (index). If data is an array, then its values will be the array indices.
console.table is pretty bare-bones, so I think people will find this project while looking for a superset of its functionality. console-table-printer looks like a good match, but the documentation implies that you have to calculate your own "Row Number" or "(index)" column. If that were the case (I know it isn't, but I'll discuss that below), calculating your own "Row Number" or "(index)" column is a nontrivial effort: Each addRow call would need access to a rowCounter variable and the ability to increment it. This has the potential of changing many internal API's of the dependent package.
I believe it's already possible to do this with a Calculated Column, but I didn't find that an obvious place to look. That may be because I assumed I would have to calculate this column on my own before I got to this section. Could an earlier example use a calculated column to create a "Row Number" column?
Alternatively, if the Table API provided a .length or .size() that returned a number, creating a custom "Row Number" or "(index)" column would become straightforward.
The text was updated successfully, but these errors were encountered:
DanKaplanSES
changed the title
Documentation Request: Make it easier to find how to create a "Row Number" column
Documentation and/or Feature Request: Make it easier to learn how to create a "Row Number" column
Jan 30, 2024
For context,
console.table
provides an "(index)" column:console.table
is pretty bare-bones, so I think people will find this project while looking for a superset of its functionality. console-table-printer looks like a good match, but the documentation implies that you have to calculate your own "Row Number" or "(index)" column. If that were the case (I know it isn't, but I'll discuss that below), calculating your own "Row Number" or "(index)" column is a nontrivial effort: EachaddRow
call would need access to arowCounter
variable and the ability to increment it. This has the potential of changing many internal API's of the dependent package.I believe it's already possible to do this with a Calculated Column, but I didn't find that an obvious place to look. That may be because I assumed I would have to calculate this column on my own before I got to this section. Could an earlier example use a calculated column to create a "Row Number" column?
Alternatively, if the
Table
API provided a.length
or.size()
that returned a number, creating a custom "Row Number" or "(index)" column would become straightforward.The text was updated successfully, but these errors were encountered: