I am creating a very complex view to correlate groupings of tabular data with totals that all need to align together. To do this I've come up with the following HTML:
<table>
<tr class="header_row"></tr>
<tr class="inner_group_row"></tr>
<tr class="data_row"></tr>
<tr class="data_row"></tr>
<tr class="inner_group_row"></tr>
<tr class="data_row"></tr>
<tr class="spacer_row"></tr>
<tr class="header_row"></tr>
<tr class="inner_group_row"></tr>
<tr class="data_row"></tr>
<tr class="data_row"></tr>
<tr class="spacer_row"></tr>
<tr class="totals_row"></tr>
<tr class="average_row"></tr>
</table>
This works fine, but the end game is that the user can click a button and render this out to a PDF that they will then be given to download (based on filters and other things they change on the fly).
When the PDF is generated (via EvoPdf) I want to make sure that page breaks don't break up a grouping, so I modified the HTML to be like so:
<table>
<tbody class="data_group">
<tr class="header_row"></tr>
<tr class="inner_group_row"></tr>
<tr class="data_row"></tr>
<tr class="data_row"></tr>
<tr class="inner_group_row"></tr>
<tr class="data_row"></tr>
<tr class="spacer_row"></tr>
</tbody>
<tbody class="data_group">
<tr class="header_row"></tr>
<tr class="inner_group_row"></tr>
<tr class="data_row"></tr>
<tr class="data_row"></tr>
<tr class="spacer_row"></tr>
</tbody>
<tbody class="totals_group">
<tr class="totals_row"></tr>
<tr class="average_row"></tr>
</tbody>
</table>
<style>
.data_group, .totals_group { page-break-inside: avoid; }
<style>
Now if the 2nd data_group
as a whole doesn't fit on the first page it's now correctly putting the 2nd data_group
onto a new page. Perfect.
Except when a data_group
is bigger than a single page. Then I'd like to try and at least make all rows related to the inner grouping stay together. However, this has me stumped as you cannot nest <tbody>
tags inside each other.
At this point I am stumped on how to group several rows together when they've already been grouped at a higher level.
Note that all rows (even inner_group_row
rows) have tabular data that all needs to line up with all other rows in the whole table,