question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement 'colspan' for tables

See original GitHub issue

How 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:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:8

github_iconTop GitHub Comments

10reactions
willmcgugancommented, Jul 21, 2020

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.

2reactions
ronfcommented, Jan 1, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Table Colspan & Rowspan - W3Schools
HTML tables can have cells that span over multiple rows and/or columns. ... To make a cell span over multiple columns, use the...
Read more >
Table Rowspan And Colspan In HTML Explained (With ...
Both colspan= and rowspan= are attributes of the two table-cell elements, <th> and <td> . They provide the same functionality as “merge cell”...
Read more >
HTML | colspan Attribute - GeeksforGeeks
The colspan attribute in HTML specifies the number of columns a cell should span. It allows the single table cell to span the...
Read more >
How to Implement HTML Colspan with Examples? - eduCBA
HTML Colspan is the attribute used in the table for diving columns into the cell. It allows users to divide single table cells...
Read more >
HTML colspan Attribute - Tutorialspoint
The colspan attribute in HTML is used to set the number of columns a cell should span in a table. Use the colspan...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found