libfort
libfort copied to clipboard
Is it possible to erase table data and add new data, but keep the header
We have a command line utility that uses this library to show the output in a tabular form, which is fetched from a running application. The header row of this output does not change between 2 invocations of the tool, but the data might change (as it has time stamps etc). Currently we create a table from scratch every time the tool is run. But the tool is run quite frequently (in fact with watch
command), so I was wondering if we can create the header added just once and the data can be repopulated every time.. Is it possible?
Hi! At the moment you can only change content of the cells but can't delete them. In your particular case I think it is ok to create a table from scratch each time since creating a header shouldn't take much time. But anyway it seems reasonable to me to have API functions to delete particular cells, rows etc. They may be very useful in case of big tables when you have to delete only some rows while preserving most of the table. Also maybe such API will be useful in your case. I'll take a few days to think about an appropriate API so that it will be possible to delete particular cells, rows, range of rows etc. I'll try to add it by the end of the week.
Hi, merged changes to develop. Now it's possible to erase columns, rows or range of cells:
// erase row
table.row(42).erase();
// erase column
table.column(3).erase();
// erase range of cells
table.range(1, 0, 42, 43).erase();
For your example when you wanted to delete everything except the top most row you can write:
table.range(1, 0, FT_MAX_ROW_INDEX, FT_MAX_COL_INDEX).erase();