Documentation and/or Feature Request: Make it easier to learn how to create a "Row Number" column
Opened this issue · 0 comments
For context, console.table
provides an "(index)" column:
The first column in the table will be labeled
(index)
. Ifdata
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.