-
Notifications
You must be signed in to change notification settings - Fork 31
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
Reimagine column handling #144
Comments
I gave this a lot of thought and here's what I came up with. Current ProblemThe current implementation doesn't allow:
Design ProposalSince this is about rethinking how the API would work and since this change will be breaking anyway, let's use this opportunity and do it properly. Column improvementsAccessing columns is currently annoying and error prone.
Adding columns
Removing columnsI found no good way of actually removing columns. As the whole idea of this request is to remove implicit logic, I decided to forbid removal of columns. Hiding columnsCurrently, the functionality to hide a column is implemented as a
Error handlingPreviously, comfy-table was able to do things in an "optimistic" manner. With the trend to giving developers more power, we also have to introduce error handling.
Requested Feature: Removing rows/swapping columnsThere were two additional requested features:
With the current builder design, these features won't be implemented, as this would only lead to confusion.
There're two solutions to this problem:
To be honest, I'm inclined to tell people that they should just rebuild the whole table if they want complex interactions. -> Until there's a good design proposal that doesn't make the library less usable/unusable for the vast majority of its users, these two features won't be added. Who builds this?I am very happy with the current state of comfy-table and I don't need any of said functionality myself. As usual, I'll give any MRs thorough reviews as long as they're well documented and properly tested (via actual tests). So, if anyone needs this and has some spare time at their hand, I would be happy to see this merged into comfy-table :). |
The current column handling is rather convenient, as columns get populated as rows and cells are added to the table.
However, this logic is rather implicit. There's no way to remove or add columns half-way through a table creation process.
To fix this
I'm actually in favor of the second approach, since the goal of comfy-table is to be minimalistic and convenient to use.
Explicit column handling is more of an edge-case and the 99% use case is covered by implicit column creation.
However, it could be very tricky to design the API around an optionally explicit column handling, since such APIs tend to get confusing quite quickly.
This ticket is mostly for discussion on how such an API would look like.
Relevant tickets/MRs:
#121
Previous ticket:
#124
The text was updated successfully, but these errors were encountered: