tty-table icon indicating copy to clipboard operation
tty-table copied to clipboard

Automatic width not correct when using formatter

Open Richie765 opened this issue 4 years ago • 1 comments

Problem Summary

I'm using a formatter function to add 'USD' to a money amount. The automatic column width is determined by the value before the formatter instead of the string returned by the formatter.

Expected Result (screen shot if possible)

Automatic column width should be wider.

Actual Result (screen shot if possible)

It's the width based on the original value before the formatter.

Steps to Reproduce

  1. Basic table code without specifying column widths
  2. formatter: (cellValue) => { return cellValue + ' USD' }
  3. Column is not wide enough.

Richie765 avatar Apr 11 '20 08:04 Richie765

Thanks for reporting. I don't really have time to add this feature at the moment, but I'd be happy to merge your pull request.

You can also set column widths to a fixed value or a percentage to remedy this.

tecfu avatar Apr 13 '20 17:04 tecfu