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

[feature] reset, empty rows

Open dawadam opened this issue 1 year ago • 6 comments

Hi, thanks for great job. Is it possible to reset, empty rows ? For making a dynamic array.

dawadam avatar Mar 25 '23 15:03 dawadam

Could you set an example with image? @dawadam

ayonious avatar Mar 27 '23 14:03 ayonious

Ok, but i don't have image. Just if i take the basic exemple and i want to display and update content, like this :

const { printTable } = require('console-table-printer');

//Create a table
const testCases = [
  { index: 3, text: 'I would like some gelb bananen bitte', value: 100 },
  { index: 4, text: 'I hope batch update is working', value: 300 },
];

//print
printTable(testCases);

// waiting time (exemple fetch data on internet)
await delay(1000)

const testCases_v2 = [
  { index: 5, text: 'I would like update data !', value: 123 }
];

//print
printTable(testCases_v2);

Table can't be updated.

dawadam avatar Mar 29 '23 13:03 dawadam

@dawadam for that reason you can create a Table instance like this and add as much content possible. https://console-table.netlify.app/docs/doc-table-instance-creation

ayonious avatar Apr 02 '23 14:04 ayonious

Ok, i see. But if i want to update or remove data from the Table ?

dawadam avatar Apr 02 '23 17:04 dawadam

True! that feature is not there.

The primary goal of this This package is printing objects. Features related to changing/updating data is Optional Having many features to manipulate data makes this package a Database/storage for which there are other packages.

But if this feature is requested by more people I will priotize it.

ayonious avatar Apr 04 '23 08:04 ayonious

+1

antofa avatar Apr 08 '24 23:04 antofa