I a couple of issues using Tablesorter 2.0.3.
The first issue is when I set a colspan on my table. Basically when I do this as below it doesn’t sort the respective columns.
<table>
<thead>
<th colspan="3"></th>
<th>Four</th>
<th>Five</th>
<th>Six</th>
<th>Seven</th>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>
</tbody>
</table>
The second issue I have is that no matter what I set the sortInitialOrder (“desc” or “asc”) in the tablesorter.js, it doesn’t have any effect to making the sort ascending or descending when it is clicked on.
Please can anyone help?
To solve problem one you can create your own mapping of headers to data cols. here’s what I did to get the functionality the way I wanted.
I’ve added the following method to tablesorter.js:
And also added the following to
this.defaultsThe, change the following method:
Last but not least, add/change the following in
$headers.click(function(e) {Add:
Change:
config.sortList.push([i,this.order]);Toconfig.sortList.push([ia,this.order]);When you init the tablesorter pass a
customMap[[header_col_id, data_col_id]]In your case it’ll be: