Jquery tablesorter,table排序
2010-05-29 23:11
281 查看
Jquery+tablesort 实现客服端的排序,能减轻服务器的承受能力,也能给用户带来很好的体验,所以推荐用 Jquery tablesort来实现分页和排序了
Jquery tablesort 支持页面类table静态排序,无刷新,调用也很方便(支持字符串,数字,日期,等格式)
唯一的要求,就是html的table标签内要包含thead和tbody部分,这可以调用HTML_Table::getHeader()生成thead,调用HTML_Table::getBody()生成tbody部分。
然后在需要展示数据的页面引入jQuery和Tablesorter的js库文件,再加上几行代码即可实现客户端javascript对数据table的分页与排序,并且还支持动态修改每页数据行数,支持多列排序等。
具体的例子和代码,都可以在本文的链接中找到,就不在这里多说了。
示例地址:http://www.aquna.com/0518/jquery/Jquer-tablesorter.html
只需要设置table的id,部分代码:
$(document).ready(function() {
$.tablesorter.defaults.widgets = ['zebra']; 隔行换色的颜色
$("#myTable").tablesorter({ myTable为table的Id
textExtraction: function(node) {
return $(node).find(".findeValue").html();
} ,
headers: {
5: { sorter: false }
}
});
});
Table 格式如下:
<table class="tablesorter" cellspacing="1">
<thead> <tr>
<th>
first name</th><th>last name</th><th>
age</th>
<th>total</th><th>discount</th><th>date</th></tr>
</thead>
<tbody>
<tr><td>peter</td>
<td>parker</td><td>28</td>
<td>$9.99</td><td>20%</td>
<td>jul 6, 2006 8:14 am</td></tr>
</tbody>
</table>
官方示例地址:http://docs.jquery.com/Plugins/Tablesorter/tablesorter
Jquery tablesort 支持页面类table静态排序,无刷新,调用也很方便(支持字符串,数字,日期,等格式)
唯一的要求,就是html的table标签内要包含thead和tbody部分,这可以调用HTML_Table::getHeader()生成thead,调用HTML_Table::getBody()生成tbody部分。
然后在需要展示数据的页面引入jQuery和Tablesorter的js库文件,再加上几行代码即可实现客户端javascript对数据table的分页与排序,并且还支持动态修改每页数据行数,支持多列排序等。
具体的例子和代码,都可以在本文的链接中找到,就不在这里多说了。
示例地址:http://www.aquna.com/0518/jquery/Jquer-tablesorter.html
只需要设置table的id,部分代码:
$(document).ready(function() {
$.tablesorter.defaults.widgets = ['zebra']; 隔行换色的颜色
$("#myTable").tablesorter({ myTable为table的Id
textExtraction: function(node) {
return $(node).find(".findeValue").html();
} ,
headers: {
5: { sorter: false }
}
});
});
Table 格式如下:
<table class="tablesorter" cellspacing="1">
<thead> <tr>
<th>
first name</th><th>last name</th><th>
age</th>
<th>total</th><th>discount</th><th>date</th></tr>
</thead>
<tbody>
<tr><td>peter</td>
<td>parker</td><td>28</td>
<td>$9.99</td><td>20%</td>
<td>jul 6, 2006 8:14 am</td></tr>
</tbody>
</table>
官方示例地址:http://docs.jquery.com/Plugins/Tablesorter/tablesorter
相关文章推荐
- javascript table排序之jquery.tablesorter.js
- jquery +jquery.tablesorter+jquery.tablednd_0_5实现table表格可按行拖拽,按列排序,并可以保存排序后的结果
- jQuery表格排序(tablesorter)
- jquery+gridview+tablesorter 实现客户端排序
- jQuery html表格排序插件:tablesorter
- javascript-jquery-tablesorter的问题:如果表头是多行的,点击排序好像就不正确了
- jQuery 表格排序插件 Tablesorter 使用
- 新学的插件jquery.tablesorter很好用,说说遇到的表格动态添加的数据不能排序的问题
- jQuery插件tablesorter 表格排序 自定义排序addParser()
- jquery tablesorter对表格进行排序
- jquery 表头排序(jquery.tablesorter.js支持中文)
- jQuery 表格排序插件 Tablesorter 使用
- 使用jquery的tablesorter插件进行表格排序
- jQuery排序插件tableSorter
- jQuery 表格排序插件 Tablesorter 使用
- jQuery入门教程-使用tablesorter插件(表格排序)
- 一款用于表格数据自定义排序的jQuery插件jquery.tablesortable.js(附ajax例子)
- jquery tablesorter 动态添加数据时,排序有误。
- jquery tablesorter表格排序插件的使用
- jquery 表头排序(jquery.tablesorter.js支持中文)