console-table-printer icon indicating copy to clipboard operation
console-table-printer copied to clipboard

Print table without Table Header

Open ayonious opened this issue 3 years ago • 1 comments

Originally started from this: https://github.com/ayonious/console-table-printer/issues/361

Im trying to find the best way to allow this. How would the input in this case look like? Should it be array or arrays of string?

ayonious avatar May 12 '21 11:05 ayonious

I think passing Title value blank or null in column definition would be best. Or having a config array to Table constructor with headers: false.

Another config I am thinking of is border: false to print table without borders.

netsmertia avatar Jul 08 '21 13:07 netsmertia

Using something like this should mean that the table has empty headers:

const table = new Table({
      title: 'Bundle (BUNDLENAME)',
      columns: [
        { name: 'Weapon', title: 'WEWWWW' },
        { name: 'Chroma', title: 'WEWWWW' },
        { name: 'Quality', title: '' },
        { name: 'Price' },
      ]
    });

Now working making it work.

ayonious avatar Jul 02 '23 09:07 ayonious

Another config I am thinking of is border: false to print table without borders. You should also be able to achieve this using the border symbols set to '' Like this

const table = new Table({
      title: 'Bundle (BUNDLENAME)',
      columns: [
        { name: 'Weapon', title: 'WEWWWW' },
        { name: 'Chroma', title: 'WEWWWW' },
        { name: 'Quality', title: '' },
        { name: 'Price' },
      ],
      charLength: { '👍': 2, '✅': 2 },
      style: {
        headerTop: {
          left: '',
          mid: '',
          right: '',
          other: '',
        },
        headerBottom: {
          left: '',
          mid: '',
          right: '',
          other: '',
        },
        tableBottom: {
          left: '',
          mid: '',
          right: '',
          other: '',
        },
        vertical: '',
      },
    });

    table.addRows([
      {
        Weapon: '👍',
        Chroma: '✅',
        Quality: 'Deluxe',
        Price: '1 11 VP',
      },
      {
        Weapon: 'thing',
        Chroma: 'some',
        Quality: 'Deluxe',
        Price: '1 123 VP',
      },
      {
        Weapon: 'asdfasdf',
        Chroma: 'asfasdf',
        Quality: 'Deluxe',
        Price: '1 1000 PP',
      },
    ]);
__D_a_my-npm-packages-tester-ts

ayonious avatar Jul 02 '23 09:07 ayonious

In latest release this case has been handled __D_a_console-table-printer

ayonious avatar Jul 02 '23 10:07 ayonious