Questions about fixed headers and columns are abundant, and so are css/javascript/jQuery solutions.
Unfortunately, none of the solutions work when I have a table with different colSpan
s and rowSpan
s;
so, let's take this table for example:
<table >
<thead>
<tr >
<td rowspan="2" class="row-header">[Product.Color]</td><td rowspan="2" class="row-header">[Product.SizeUnitMeasureCode]</td><td >False</td><td >True</td>
</tr><tr>
<td >True</td><td >True</td>
</tr>
</thead><tbody>
<tr>
<td rowspan="2" class="row-header">Blue</td><td class="row-header"></td><td >225.49</td><td ></td>
</tr><tr>
<td class="row-header">CM </td><td ></td><td >23790.17</td>
</tr><tr>
<td class="row-header">Grey</td><td class="row-header"></td><td >125</td><td ></td>
</tr><tr>
<td class="row-header">Multi</td><td class="row-header"></td><td >478.92</td><td ></td>
</tr><tr>
<td rowspan="2" class="row-header">Yellow</td><td class="row-header"></td><td >215.96</td><td ></td>
</tr><tr>
<td class="row-header">CM </td><td ></td><td >34311.33</td>
</tr>
</tbody>
</table>
(fiddle)
(which generates the following:
)
(yes, you probably noticed that I'm talking about a pivot table here :)).
I would like for the column header section (gray background) to remain in place when the table content is scrolled vertically, and for the row header section (red text) to remain in place when scrolling vertically.
Any thoughts? (any css / jQuery / javascript solution will be accepted :))