-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: add Table.remove_header() #121
Conversation
Signed-off-by: Igor Pashev <pashev.igor@gmail.com>
It's generally not allowed to remove any rows, including the header right now. The reason for this is, that there's internal logic executed each time a row or the header is added, which results in the calculation of columns for the whole table. With this, you could add a header with 5 columns, rows with 3 columns, remove the header and still have a table with 5 columns even though only three are used. If we wanted the user to allow removing the header or rows, this would need to be handled. |
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #121 +/- ##
==========================================
- Coverage 96.29% 96.24% -0.05%
==========================================
Files 19 18 -1
Lines 1754 1758 +4
==========================================
+ Hits 1689 1692 +3
- Misses 65 66 +1
|
This is actually quite tricky. Imagine this scenario:
Exit scenario 1.1 - Removal of unused columns: Exit scenario 1.2 - Unused columns aren't removed: If the user would have now instead continued to use the api and would have done this:
Exit scenario 2.1 - Removal of unused columns: Exit scenario 2.2 - Unused columns aren't removed: The problem is, that I designed columns to be implicitly populated and Constraints are to be added once some rows were populated. The API design is minimalistic, convenient, but it's not designed for complex interactions, where users can remove cells or rows half-way through. It's rather designed to be used in a classic simple builder-pattern like way. I think that we shouldn't try to add this function, since it will lead to weird implicit cases, no matter how we decide to implement it. The only proper way I see to work around this, would be to make the creation of columns explicit, which would be a huge breaking change and a completely different approach to column handling. I guess this is something we could think about in the long term, but the API design should be well thought through. |
Closing for now, since this would need more work to function properly. |
About the motivation: to be able to modify a table created elsewhere. The
Clone
implementation might be helpful too, but it's orthogonal to this patch.