-
-
Notifications
You must be signed in to change notification settings - Fork 377
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(table): Multi-column table cells #1568
Comments
AI is cool with me (I use a variety of things daily). But I prefer there to be a human in the loop that checks things so they're not wasting my time like this. |
Hey there, It might be nice to see some ideas that you have for how the table API will change to support this. Have you got some ideas you can share? I'm wary of changing the table implementation too much, as it's fairly complex already, which makes adding more complexity a maintenance burden (mostly in reviewing changes). Perhaps if you're interested in implementing this, consider whether there are any simplifying refactorings that can make this easy to implement and review. Also keep in mind what impact the changes would have on existing users. One approach we like to suggest for adding more advanced behavior to widgets is to first fork them and use them in your own app with the desired changes to validate that things work correctly (note the MIT license allows you to do this, just keep the copyright notice). You might find that creating a tui-advanced-table crate might be worth considering at some point (similar to the the tui-widget-list crate) |
Hey @joshka My idea for the API would be something similar to the current Perhaps you can even support This is basically identical to the current approach for styling for end-users, so shouldn't feel out-of-place, and is completely transparant/non-breaking. In terms of rendering I am not familiar with the internals of Ratatui so I fear I can't provide much insight there. I can imagine there's some functionality that computes the area of a cell, so that should factor in the width in that case (and the width of the cell border/separator that would've gone in between the cells). |
Problem
Table cells cannot currently span across multiple columns:
This is often useful when wanting to "group" or "nest" headers:
Solution
Add an option to the
Cell
struct and take it into account when rendering the table. This means that in a table with N columns, each row can contain anywhere between 1 and N cells.Additional notes
The specific example above would also require multi-row headers, which is a separate issue out of scope for this one. Multi-col cells are still useful in other contexts as well.
The text was updated successfully, but these errors were encountered: