一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jquery.tableSort.js表格排序插件使用方法详解

时间:2017-03-27 编辑:简简单单 来源:一聚教程网

1.一定要引jQuery包,所有jq插件都是基于jQuery包的

2.如果想指定哪一栏不排序这样写$(“#mytable”).tablesorter({headers:{5:{sorter:false}}});第5列的sorter为false就OK了

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

 

 代码如下 复制代码

 

 

 

 

 

 

 

  #tip {

  border: solid 1px black;

  width: 358px;

  line-height: 21px;

  height: 21px;

  padding: 2px 10px;

  background-color: pink;

  font-size: 12px;

  text-align: center;

  margin: 10px auto 10px;

  }

 

  .table {

  width: 380px;

  margin: 0 auto;

  border-collapse: collapse;

  text-align: center;

  }

 

  .table tr td,

  .table tr th {

  background: greenyellow;

  border: solid 1px red;

  color: #666;

  height: 30px;

  /*line-height: 30px;*/

  }

 

  .table tr th {

  background: #89AFB1;

  color: red;

  text-align: center;

  font-size: 14px;

  }

 

  .table a,

  .table a:visited {

  color: red;

  text-decoration: none

  }

 

  .table a:hover,

  .table a:active {

  color: blue;

  text-decoration: none

  }

 

 

 

 

  $(function() {

  $('table').tablesort().data('tablesort');

  var i = 0;

  $(".table tr th a").click(function() {

   if (i % 2 == 0) {

   $(".sj").text('升序');

   i++;

   } else {

   $(".sj").text('降序');

   i++;

   }

  })

  })

 

 

 

 

 

 

 默认无排列规则(----)

 

 

  

编号姓名性别总分
1031李渊654
1021张扬624
1011吴敏632
1026李小明610
1016周谨690
1041谢小敏632
1072刘明明633
1063蒋忠公675

 

 

热门栏目