问题
I have a table with more than 2 rows in and i wnt to perform sorting only on 2nd row elements, how can this be achieved using table sorter?Please help me out.
回答1:
I have a similar situation, but I only use the first row for tablesorter. The second row is used for selection filters, so I always want it to stay at row 2. Putting both rows in but making the second row cells instead of <th> cells does the trick.
<table id="table" class="tablesorter">
<thead>
<tr>
<th title="Click to sort by ID ">ID</th>
<th title="Click to sort by Name ">Name</th>
<th title="Click to sort by Description ">Description</th>
</tr>
<tr>
<td><input type="text" name="org_id"/></td>
<td><input type="text" name="name"/></td>
<td><input type="text" name="business_desc"/></td>
</tr>
</thead>
<tbody>
<tr>
<td>Org 1</td>
<td>Org Name</td>
<td>Org Desc</td>
</tr>
</tbody>
</table>
回答2:
BY default it will take your last .
for changing it to first you can use. var table = $('#stu_view_example1 ').DataTable({ orderCellsTop: true or "bSortCellsTop": true });
来源:https://stackoverflow.com/questions/1502014/table-sorter-to-sort-when-i-have-more-rows-in-thead