tablesorter-jQuery插件用法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tablesorter-jQuery插件用法相关的知识,希望对你有一定的参考价值。

I found the tablesorter - jQuery plugin cool and easy to-be implemented. Plugin is written by Christian Bach and my snippet uses tablesorter version 2.0.3. Images are stored on my server as well as inlcuded .js files in example directory. Project's site: http://tablesorter.com/
  1. <style>
  2. table {
  3. table-layout:auto;
  4. border-collapse:collapse;
  5. border-color:grey;
  6. }
  7.  
  8. th {
  9. background-repeat: no-repeat;
  10. background-position: center left;
  11. margin-left: -1px;
  12. padding-left: 20px;
  13. }
  14.  
  15. th.header {
  16. background-image: url(http://www.polet.cz/images/examples/small.gif);
  17. cursor: pointer;
  18. font-weight: bold;
  19. background-position: center left;
  20. padding-left: 20px;
  21. }
  22.  
  23. th.header:hover {
  24. cursor: pointer;
  25. font-weight: bold;
  26. background-repeat: no-repeat;
  27. background-position: center left;
  28. padding-left: 20px;
  29. }
  30.  
  31. th.headerSortUp {
  32. background-image: url(http://www.polet.cz/images/examples/asc.gif);
  33. }
  34.  
  35. th.headerSortDown {
  36. background-image: url(http://www.polet.cz/images/examples/desc.gif);
  37. }
  38. </style>
  39.  
  40. <script type="text/javascript" src="http://www.polet.cz/examples/jquery-1.3.1.js"></script>
  41. <script type="text/javascript" src="http://www.polet.cz/examples/jquery.tablesorter.js"></script>
  42. <script type="text/javascript">
  43.  
  44. $(document).ready(function()
  45. {
  46. $("#table1").tablesorter(
  47. {
  48. /* Initial sort by first [[column],[asc]] */
  49. sortList: [[0,0]],
  50.  
  51. /* Turns off sorting ability for 3rd column */
  52. headers: {
  53. 2: {
  54. sorter: false
  55. },
  56. }
  57. });
  58. });
  59. </script>
  60.  
  61. <table id="table1" border="1" cellpadding="5px">
  62. <thead>
  63. <tr>
  64. <th>Letter</th>
  65. <th>Digit</th>
  66. <th>Not sortable column</td>
  67. <th>URL</td>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. <tr>
  72. <td>a</td>
  73. <td>9</td>
  74. <td>1</td>
  75. <td><a href=''>http://example/a9</a></td>
  76. </tr>
  77. <tr>
  78. <td>b</td>
  79. <td>1</td>
  80. <td>2</td>
  81. <td><a href=''>http://example/b1</a></td>
  82. </tr>
  83. <tr>
  84. <td>c</td>
  85. <td>2</td>
  86. <td>3</td>
  87. <td><a href=''>http://example/c2</a></td>
  88. </tr>
  89. <tr>
  90. <td>d</td>
  91. <td>8</td>
  92. <td>4</td>
  93. <td><a href=''>http://example/d8</a></td>
  94. </tr>
  95. <tr>
  96. <td>e</td>
  97. <td>6</td>
  98. <td>5</td>
  99. <td><a href=''>http://example/e6</a></td>
  100. </tr>
  101. <tr>
  102. <td>f</td>
  103. <td>5</td>
  104. <td>6</td>
  105. <td><a href=''>http://example/f5</a></td>
  106. </tr>
  107. </tbody>
  108. </table>

以上是关于tablesorter-jQuery插件用法的主要内容,如果未能解决你的问题,请参考以下文章

Android 插件化VirtualApp 安装并启动资源中自带的 APK 插件 ( 添加依赖库 | 准备插件 APK | 启动插件引擎 | 拷贝 APK 插件 | 安装插件 | 启动插件 )(代码片

错误记录发布 Flutter 插件包报错 ( It‘s strongly recommended to include a “homepage“ or “repository“ field )(代码片

nprogress页面加载进度条 VUE 插件片

validate 的插件用法

QT插件

Android Gradle 插件自定义 Gradle 任务 ④ ( Task#doLast 函数用法 | 自定义 Gradle 任务代码示例 )