ajax json 表格排序,分页,自定义每页数量

前端之家收集整理的这篇文章主要介绍了ajax json 表格排序,分页,自定义每页数量前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

ajax json 表格排序,分页自定义每页数量

点击表头可以排序,按照升序或者降序,另外支持多列排序

设置每页数量


XML/HTML Code
  1. <tableid='example3'>
  2. thead>
  3. tr>
  4. th>ID</th>
  5. th>Firstname</th>
  6. th>Lastname</th>Grade</th>Grade2</th>Efficiency</th>Age</th>Company</</tr>
  7. thead>
  8. tbody>
  9. tbody>
  10. table>

JavaScript Code

    <scripttype='text/javascript'>
  1. $(function(){
  2. $.ajax({
  3. url:"example3.json",
  4. dataType:"json"
  5. }).done(function(data){
  6. console.log(data);
  7. $("#example3").slimtable({
  8. tableData:data
  9. });
  10. }).fail(function(param1,param2){
  11. console.log("error:"+param2);
  12. });
  13. </script>

example3.json

XML/HTML Code
    [
  1. ["1","ex1","ex_a","2,5","2.5","30%","19","ex_a1"],
  2. ["2","ex2","ex_b","5,4","5.4","28,5%","33","ex_b1"],
  3. ["3","ex3","ex_c","16,7","16.7","19,3%","ex_c1"],0);">["4","ex4","ex_d",8","2.8","1,8%","28",0);">["5","ex6","ex_e",85%","44",0);">["6","ex7","ex_f","5.5","16%","52","ex_d1"],0);">["7","ex8","ex_g","6,"6.8",9%","39","ex_e1"],0);">["8","ex9","ex_h","freejs.net"]
  4. ]


原文地址: http://www.freejs.net/article_fenye_156.html

猜你在找的Ajax相关文章