Forum How do I...?

Repeating table rows that are outside thead

Rutger
Hi,

I have a long table that is 'grouped' into subsections by some rows
tr.sectiontitle


I was wondering if it is somehow possible to repeat those rows on following pages underneath the already repeated thead elements? They should repeat until a new sectiontitle row is found.

I tried to do this with
display: table-header-group;

but that does not seem to do anything.

Any help would be appreciated!
howcome
Could you post an image of what you want to achieve?
Rutger
Sorry, should have done that in my first post of course.

In this screenshot, you see that the first row is repeated on the second page. I would like to do this with only one actual row being present in the table.

It should repeat on as many pages as needed until another row of that type is found, which should then be repeated if needed.

I would like to avoid inserting copies of that row to keep my logic as flexible as possible.

I added a sample HTML file that I use for testing.
  1. index.html11.4 kB
  2. repeating-tablerow.png43.7 kB

Edited by Rutger

howcome
Thanks. It's a compelling use case, for which I have found no good solution.

There is a (fairly contrived) example of how you can generate dynamic table footers in this example:

https://css4.pub/2024/boxtracking/index#subtotals

You could do the same for table headers, but you will run into issues when the number of lines in the table header changes.

A better option would be for Prince to start supporting multiple <thead> elements, as in:

<table>
<thead>first header</thead>
<tbody>
....
....
</tbody>
<thead>second header</thead>
<tbody>
...
...
</tbody>
</table>


This would work much like running headers in page margins.

Edited by howcome

Rutger
Hi,

Thanks for your answer. For now I'll try to find a more 'manual' approach by inserting these rows by hand and force a pagebreak I think.

Would indeed be great if Prince would support multiple <thead> elements. Hope to see that feature in the near future if possible!