jQuery 表格排序插件 Tablesorter 使用
来源:互联网 发布:淘宝店一共有多少分 编辑:程序博客网 时间:2024/05/16 11:56
http://blog.csdn.net/leixiaohua1020/article/details/12582373
jQuery 表格排序插件 Tablesorter 使用方式如下:
1.引入头文件(注意一定要把jQuery放在前面):
- <script src="lib/jquery-1.8.3.min.js"></script>
- <!--tablesorter-->
- <link href="css/css_tablesorter_green/style.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="lib/jquery.tablesorter.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $("#alltable").tablesorter();
- });
- </script>
2.在需要使用排序的<Table>上无需做任何设定,很方便:
- <table id="alltable" class="tablesorter" width="584">
- <thead>
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- <th>Email</th>
- <th>Due</th>
- <th>Web Site</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Smith</td>
- <td>John</td>
- <td>jsmith@gmail.com</td>
- <td>$50.00</td>
- <td>http://www.jsmith.com</td>
- </tr>
- <tr>
- <td>Bach</td>
- <td>Frank</td>
- <td>fbach@yahoo.com</td>
- <td>$50.00</td>
- <td>http://www.frank.com</td>
- </tr>
- <tr>
- <td>Doe</td>
- <td>Jason</td>
- <td>jdoe@hotmail.com</td>
- <td>$100.00</td>
- <td>http://www.jdoe.com</td>
- </tr>
- <tr>
- <td>Conway</td>
- <td>Tim</td>
- <td>tconway@earthlink.net</td>
- <td>$50.00</td>
- <td>http://www.timconway.com</td>
- </tr>
- </tbody>
- </table>
在<thead>上就会有两个小三角符号,点击可以用于排序。
Tablesorter下载地址:http://download.csdn.net/detail/leixiaohua1020/6377187
PS: After AJAX, the tablesorter does not work any more.
Reason:
http://stackoverflow.com/questions/3210933/jquery-tablesorter-plugin-does-not-work-after-ajax-call
The new DOM elements are not binded to the JavaScript events. jQuery handles a similar problem using it's 'live' function. Once the AJAX call has completed, rerun the javascript in document.ready().
My Solution:
$.ajax({ type: "GET", url: "/Job/Filter/" + userId, data: { status: status }, error: function (xhr, ajaxOptions, thrownError) { alert('Error during process: \n' + xhr.status); } }) .done(function (partialViewResult) { $("#jobsdiv").empty(); $("#jobsdiv").html(partialViewResult); $.each( $('.dropdown-toggle'), function () { $(this).append(" <span class='caret'></span>"); $(this).attr("data-toggle", "dropdown"); } ); $(document).ready(function () { $("#jobsTable").tablesorter(); }); });Just rerun the .ready(), it will work again.
0 0
- jQuery入门教程-使用tablesorter插件(表格排序)
- jQuery 表格排序插件 Tablesorter 使用
- jQuery 表格排序插件 Tablesorter 使用
- jQuery 表格排序插件 Tablesorter 使用
- jquery tablesorter表格排序插件的使用
- jquery tablesorter插件 表格排序
- jquery.tablesorter表格排序插件的使用 收藏
- 表格排序——jQuery插件tablesorter的使用
- jQuery html表格排序插件:tablesorter
- jQuery.tablesorter html表格排序插件
- 表格排序插件 Tablesorter
- JQuery插件——tablesorter插件(表格排序)
- jQuery插件tablesorter 表格排序 自定义排序addParser()
- jQuery tablesorter 插件使用
- jQuery tablesorter 插件使用
- jQuery tablesorter 插件使用
- jQuery表格排序组件-tablesorter
- jQuery表格排序组件-tablesorter
- fedora系统布的tomcat服务在其他电脑上访问不到
- 第十六周ACM(1)
- 源码安装libvirt 常见问题
- hive--2014.6.10
- mac下安装安卓开发环境
- jQuery 表格排序插件 Tablesorter 使用
- js自己写的一个手机电话同时可以验证的正则表达式
- Oracle中得blob字段导入到DB2的Blob字段
- 如果我只有一点点喜欢你,我就不会给你说
- 重构机房收费系统总结1之配置文件+反射+抽象工厂
- 践行群众路线,放飞我的梦想
- SVD奇异值分解(3)-推荐算法应用
- JSON.parse()和JSON.stringify()
- Swift UI学习之基础:UIButton,UILabel and UISlider