Implement 'colspan' for tables
See original GitHub issueHow would you improve Rich?
I am writing a script for time bookings currently, which generates tables with a simple row-setup:
| Clock-in | Clock-out | Duration |
| 8:00 | 10:00 | 2:00 |
Then, after each column, I’d like to enter another row to display the period between the current and the next record, but this one should consist of 2 fields only and maybe also has a different style (color, italics, …), with the first two merged to match the overall column alignment:
| Clock-in | Clock-out | Duration |
| 8:00 | 10:00 | 2:00 |
| PAUSE | 0:45 |
| 10:45 | 17:00 | 6:15 |
Another use-case for this is, when you want to end the table with a sum-footer:
| Clock-in | Clock-out | Duration |
| 8:00 | 10:00 | 2:00 |
| PAUSE | 0:45 |
| 10:45 | 17:00 | 6:15 |
| Sum of working hours | 8:15 |
Maybe I am reading the docs wrong, but I couldn’t find an obvious way to achieve that; tables in rich seem to be defined once and rows can only be appended from there. Yes, it is possible to enter None as a value, but this just leaves the existing cell empty and does not solve the feature for an alternate style of that rows:
| Clock-in | Clock-out | Duration |
| 8:00 | 10:00 | 2:00 |
| 10:45 | 17:00 | 6:15 |
| Sum of working hours | | 8:15 |
What problem does it solved for you?
This feature would make the table rendering an even greater way to produce great tables for more representation use-cases than it can serve currently.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:8
Top GitHub Comments
This is something I’ve been thinking about for a while. It’s tricky to implement, but would be a nice feature. I’m hoping to get sponsorship for enhancements such as these. I’ll keep this ticket open as a reminder.
This is something I have a couple of uses for, but for my use cases right now I’d be happy to start off with just being able to request space across multiple columns in a single row, but not multiple rows. This seems like it would be simpler to implement, and might be a stepping stone toward full colspan/rowspan capabilities.
Really, all I need is a way for some cell values to grow beyond the width available to that column, overwriting vertical separators and data in neighboring columns in that row. I’m thinking one might be able to request this behavior on a table cell with a new value for “overflow”. I know this wouldn’t provide true colspan functionality (particularly about removing the grid separators regardless of the size of the values inside), but I can see people possibly wanting this kind of dynamic behavior in some cases as an independent feature, without setting up colspan explicitly in every place it is needed.