引入js/css
<link href="<%=basePath %>static/jQuery/style.css" rel="stylesheet" />
<script type="text/javascript" src="<%=basePath %>static/jQuery/jquery-latest.js" ></script>
<script type="text/javascript" src="<%=basePath %>static/jQuery/jquery.tablesorter.js" ></script>
注意事项一:
1.给table加一个id,class中加入tablesorter
2.表头用<thead>包含,且表头必须用<th>,不能用<td>
3.中间内容用<tbody>
如下
<table id="table_report" class="table table-bordered table-striped add-tb-set table-hover tablesorter" style="font-size:11pt;">
<thead class="tb-fcolor">
<tr>
<th>表头</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
引入方法
<script type="text/javascript">
//所有表头排序
$(document).ready(function()
{
$("#table_report").tablesorter();
}
);
//具体哪些表头作排序
// $(document).ready(function()
// {
// $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} );
// }
// );
</script>
<script type="text/javascript">