Jquery    分页案例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jquery分页</title>
<link href="../../Script/plugins/jquery/paginathing/bootstrap.min.css" rel="stylesheet" />
<!-- 新 Bootstrap 核心 CSS 文件 -->
<!--<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">-->
<style>
.Pagination {
width: 1000px;
}
</style>
</head>
<body>
<div style="width:80%">
<table id="article_list" cellspacing="0" class="table table-small-font table-bordered table-striped">
<thead>
<tr>
<th data-priority="1">
编号
</th>
<th data-priority="1">
城市
</th>
</tr>
</thead>
<tbody id="contentTbody"></tbody>
</table>
<div class="setPageDiv">
<div class="Pagination" id="pagination"></div>
</div>
</div> <!--<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>-->
<script src="../../Script/plugins/jquery/jquery-1.9.1.min.js"></script>
<script src="../../Script/plugins/jquery/paginathing/paginathing.js"></script>
<script src="../../Script/plugins/0com/template-simple.js"></script>
<script src="https://files.cnblogs.com/files/kikyoqiang/silence.min.js"></script>
<script id="test" type="text/html">
{{each list as item}}
<tr>
<td>{{item.name}}</td>
<td>{{item.value}}</td>
<tr>
{{/each}}
</script>
<script type="text/javascript"> $(function () {
SelectLoadTable();
}); function SelectLoadTable() {
var str = "[ { name: '1', value: '0' }, { name: '6101', value: '北京市' }, { name: '6102', value: '天津市' }," +
"{ name: '6103', value: '上海市' }, { name: '6104', value: '重庆市' }, { name: '6105', value: '渭南市' }," +
"{ name: '6106', value: '延安市1' }, { name: '6107', value: '汉中市1' }, { name: '6108', value: '榆林市1' }," +
"{ name: '6106', value: '延安市2' }, { name: '6107', value: '汉中市2' }, { name: '6108', value: '榆林市2' }," +
"{ name: '6106', value: '延安市3' }, { name: '6107', value: '汉中市3' }, { name: '6108', value: '榆林市3' }," +
"{ name: '6106', value: '延安市4' }, { name: '6107', value: '汉中市4' }, { name: '6108', value: '榆林市4' }," +
"{ name: '6106', value: '延安市5' }, { name: '6107', value: '汉中市5' }, { name: '6108', value: '榆林市5' }," +
"{ name: '6106', value: '延安市5' }, { name: '6107', value: '汉中市5' }, { name: '6108', value: '榆林市5' }," +
"{ name: '6106', value: '延安市5' }, { name: '6107', value: '汉中市5' }, { name: '6108', value: '榆林市5' }," +
"{ name: '6106', value: '延安市5' }, { name: '6107', value: '汉中市5' }, { name: '6108', value: '榆林市5' }," +
"{ name: '6106', value: '延安市5' }, { name: '6107', value: '汉中市5' }, { name: '6108', value: '榆林市5' }," +
"{ name: '6109', value: '安康市' }, { name: '6110', value: '商洛市' }]";
//var strs = JSON.parse(str);
var strs = eval('(' + str + ')');
var html = template("test", { list: strs });
$("#contentTbody").html(html);
paginathing("contentTbody", 'Pagination', 5);
}; function paginathing(contentTbodyId, containerClass, limitPagination) {
$("#" + contentTbodyId).paginathing({
perPage: 10, // 每页显示的记录数。
limitPagination: limitPagination, // 可以是false或一个数值。用于限制分页的页码。
prevNext: true, // 是否允许显示前一页按钮。
firstLast: true, // 是否允许显示第一页和最后一页按钮。
prevText: '«', // 前一页按钮上显示的文字。
nextText: '»', // 下一页按钮上显示的文字。
firstText: '首页', // 第一页按钮上显示的文字。
lastText: '末页', // 最后一页按钮上显示的文字。
containerClass: containerClass, // 容器的class名称。
ulClass: 'pagination', // ul元素的class名称。
liClass: 'page', // li元素的class名称。
activeClass: 'active', // 当前分页按钮的class名称。
disabledClass: 'disable', // 被禁用的分页按钮的class名称。
insertAfter: null, //键分页传入到指定的元素之后,可以是null,或一个class名称,或一个id。
pageNumbers: true // 显示总页数,limitPagination参数必须设置为true。
});
} //function paginathing(contentTbody) {
// $('#' + contentTbody).paginathing({
// perPage: 6, // show item per page 实际为每页6/2=3行数据
// limitPagination: 5, // false or number. Limiting your pagination number.
// prevNext: true, // enable previous and next button
// firstLast: true, // enable first and last button
// prevText: '«', // Previous button text
// nextText: '»', // Next button text
// firstText: '首页', // "First button" text
// lastText: '末页', // "Last button" text
// containerClass: 'Pagination', // extend default container class
// ulClass: 'pagination', // extend default ul class
// liClass: 'page', // extend li class
// activeClass: 'active', // active link class
// disabledClass: 'disable', // disabled link class,
// insertAfter: null, //class or id (eg: .element or #element). append the paginator after certain element
// pageNumbers: true // showing current page number of total pages number, to work properly limitPagination must be true
// });
//} /*
perPage:每页显示的记录数。
limitPagination:可以是false或一个数值。用于限制分页的页码。
prevNext:是否允许显示前一页按钮。
firstLast:是否允许显示第一页和最后一页按钮。
prevText:前一页按钮上显示的文字。
nextText:下一页按钮上显示的文字。
firstText:第一页按钮上显示的文字。
lastText:最后一页按钮上显示的文字。
containerClass:容器的class名称。
ulClass:ul元素的class名称。
liClass:li元素的class名称。
activeClass:当前分页按钮的class名称。
disabledClass:被禁用的分页按钮的class名称。
insertAfter:键分页传入到指定的元素之后,可以是null,或一个class名称,或一个id。
pageNumbers:显示总页数,limitPagination参数必须设置为true。
*/
</script>
</body>
</html>

paginathing.zip

最新文章

  1. iOS---观察者模式之---&gt;KVO
  2. rails数据库查询 N + 1 查询的解决办法
  3. 阿里云CDN刷新预热接口
  4. dom4j-1.6.1.jar与dom4j-1.4.jar
  5. Java—类的封装、继承与多态
  6. Radiobutton编辑
  7. JS 计算日期天数差
  8. round(x[, n]) : 四舍五入
  9. PHP 时间函数集合
  10. 使用phpQuery实现批量文件处理
  11. (转)Linux下增加交换分区的大小
  12. EF学习笔记(八):更新关联数据
  13. [转帖]How To Be Successful
  14. 集成Struts2+Spring+Hibernate_两种方案
  15. 小众Python库介绍
  16. 分水岭算法(理论+opencv实现)
  17. zoj1649-Rescue (迷宫最短路径)【bfs 优先队列】
  18. Spring Boot 应用系列 1 -- Spring Boot 2 整合Spring Data JPA和Druid,双数据源
  19. 使用IntelliJ IDEA配置Erlang开发环境
  20. Oracle下Update语句

热门文章

  1. vue 实现 多个 数字滚动增加动效
  2. AJAX技术初级探索
  3. ENS中文文档系列之三 [ ENS常见问题 ]
  4. python的爬虫小入门
  5. @media screen 自适应笔记
  6. Java中Volatile关键字详解(转载)
  7. 《JavaScript高级程序设计》读书笔记(三)基本概念第六小节理解函数
  8. JS中bool值转换与比较
  9. pikachu-xx型注入
  10. 服务器(1)——IIS(1)——Windows7中IIS简单安装与配置(详细图解)