Reputation: 9746
I am using table sorter 2.0. Sorter works perfectly but when i add a checkbox in a column before text, the sorter doesn't work. I can put the checkbox in the separate column. But how to make it work with checkbox?
HTML
<table id="tableSorter" class="table table-bordered tablesorter">
<thead>
<tr class="tblHeadings">
<th>Category</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label class="normalLabel">
<input type="checkbox" class="cats" name="categories" value="Cat1" />
Category 1</label>
</td>
</tr>
</tbody>
</table>
Jquery
$("#tableSorter")
.tablesorter({ widthFixed: true })
.tablesorterPager({ container: jq("#pager") });
Upvotes: 1
Views: 222
Reputation: 3499
Okay, it took me a while to figure this out. But I've managed to do it reading the manual of tablesorter.
You have to do a trigger update after you append the new tr.
$("#tableSorter").trigger('update');
That's basicly it.
P.S. Do not copy and paste the jQuery completely, as this first bit is the full tablesorter code. Could not include it in JSFIDDLE because of http connection.
Upvotes: 1