I am using the tablesorter jquery plugin and my table has two rows in the header. Is there any way to enable sorting on my table? it should be able to be sortable by the second header row the first header row is just there to group related data by a date. If this is not possible using this plugin maybe someone has a suggestion for a workaround?
Here is an example of my table markup
<table>
<thead>
<tr>
<th colspan="3">January</th>
<th colspan="3">February</th>
<th colspan="3">March</th>
</tr>
<tr>
<!-- January -->
<th>Metric 1</th>
<th>Metric 2</th>
<th>Metric 3</th>
<!-- February -->
<th>Metric 1</th>
<th>Metric 2</th>
<th>Metric 3</th>
<!-- March -->
<th>Metric 1</th>
<th>Metric 2</th>
<th>Metric 3</th>
</tr>
</thead>
<tbody>
<tr>
<!-- January -->
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
<!-- February -->
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
<!-- March -->
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
</tr>
<tr>...</tr>
<tr>...</tr>
<!-- etc -->
</tbody>
<table>
All you had to do was try ;)
http://jsfiddle.net/Mottie/4mVfu/402/
If you want the top row disabled, then add a sorter-false
class to those header cells:
<tr>
<th class="sorter-false" colspan="3">January</th>
<th class="sorter-false" colspan="3">February</th>
<th class="sorter-false" colspan="3">March</th>
</tr>
http://jsfiddle.net/Mottie/4mVfu/403/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With