Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to erase table data and add new data, but keep the header #31

Open
pkbehera opened this issue Jan 15, 2020 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@pkbehera
Copy link

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?

@seleznevae
Copy link
Owner

seleznevae commented Jan 15, 2020

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.

@seleznevae seleznevae added the enhancement New feature or request label Jan 15, 2020
@seleznevae
Copy link
Owner

seleznevae commented Jan 25, 2020

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants