resetPage.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <title>自定义分页 - 数据表格</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>组件</cite></a>
  6. <a><cite>数据表格</cite></a>
  7. <a><cite>自定义分页</cite></a>
  8. </div>
  9. </div>
  10. <div class="layui-fluid">
  11. <div class="layui-row layui-col-space15">
  12. <div class="layui-col-md12">
  13. <div class="layui-card">
  14. <div class="layui-card-header">自定义分页</div>
  15. <div class="layui-card-body">
  16. <table class="layui-hide" id="test-table-resetPage"></table>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <script>
  23. layui.use(['admin', 'table'], function(){
  24. var admin = layui.admin
  25. ,table = layui.table;
  26. table.render({
  27. elem: '#test-table-resetPage'
  28. ,url: './json/table/user.js'
  29. ,page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
  30. layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
  31. //,curr: 5 //设定初始在第 5 页
  32. ,groups: 1 //只显示 1 个连续页码
  33. ,first: false //不显示首页
  34. ,last: false //不显示尾页
  35. }
  36. ,cols: [[
  37. {field:'id', width:80, title: 'ID', sort: true}
  38. ,{field:'username', width:100, title: '用户名'}
  39. ,{field:'sex', width:80, title: '性别', sort: true}
  40. ,{field:'city', width:80, title: '城市'}
  41. ,{field:'sign', title: '签名', minWidth: 150}
  42. ,{field:'experience', width:80, title: '积分', sort: true}
  43. ,{field:'score', width:80, title: '评分', sort: true}
  44. ,{field:'classify', width:80, title: '职业'}
  45. ,{field:'wealth', width:135, title: '财富', sort: true}
  46. ]]
  47. });
  48. });
  49. </script>