bootstrap分页
2016-03-10 09:02
519 查看
js页面:
$(function(){
var pageitem = 20;
var isfirstload = true;
function initPagination(count){
var num_entries = 0;
if(null == count){
num_entries = $("#count").val();
if(null == num_entries){
num_entries = 0;
}else{
totalcount = num_entries;
}
}else{
num_entries = count;
}
if(num_entries==0){
return;
}
var currentpage = $("#currentpage").val();
if(null==currentpage||""==currentpage){
currentpage=0;//当显示第一页时
}
$("#Pagination").pagination(num_entries,{
num_edge_entries:3,//边缘显示页数
num_display_entries:8,//主体显示页数
current_page:currentpage,
callback:pageselectCallback,
items_per_page:pageitem,//每页显示条数
prev_text:"上一页",
next_text:"下一页"
});
};
function pageselectCallback(page_index,jq){
if(isfirstload){
isfirstload = false;
return;
}
window.location.href="myorders?currentpage="+page_index+"&count="+totalcount+"&pageitem="+pageitem;
}
initPagination();
})
html页面加上:
<div class="t_center" style="text-align:center">
<div id="Pagination" class="pagination" ></div>
</div>
后台:
需要传给后台当前页,每页显示数,总数量,第一次查询时设置好,并且返回
$(function(){
var pageitem = 20;
var isfirstload = true;
function initPagination(count){
var num_entries = 0;
if(null == count){
num_entries = $("#count").val();
if(null == num_entries){
num_entries = 0;
}else{
totalcount = num_entries;
}
}else{
num_entries = count;
}
if(num_entries==0){
return;
}
var currentpage = $("#currentpage").val();
if(null==currentpage||""==currentpage){
currentpage=0;//当显示第一页时
}
$("#Pagination").pagination(num_entries,{
num_edge_entries:3,//边缘显示页数
num_display_entries:8,//主体显示页数
current_page:currentpage,
callback:pageselectCallback,
items_per_page:pageitem,//每页显示条数
prev_text:"上一页",
next_text:"下一页"
});
};
function pageselectCallback(page_index,jq){
if(isfirstload){
isfirstload = false;
return;
}
window.location.href="myorders?currentpage="+page_index+"&count="+totalcount+"&pageitem="+pageitem;
}
initPagination();
})
html页面加上:
<div class="t_center" style="text-align:center">
<div id="Pagination" class="pagination" ></div>
</div>
后台:
需要传给后台当前页,每页显示数,总数量,第一次查询时设置好,并且返回
相关文章推荐
- bootstrap table 行号 显示行号 添加行号 bootstrap-table 行号
- 关于Bootstrap弹出框无法调用问题的解决办法
- bootstrap聪明在哪里(CSS)
- BootStrap入门_创建第一个例子
- Bootstrap—后台框架Ace
- 安全权限、高性能、高并发、分布式java shiro、maven、Bootstrap、SpringMVC、Mybatis
- bootstrap fileupload相关
- Bootstrap相关教程
- 关于bootstrap upload url传输参数问题
- bootstrap的栅格布局不支持IE8该如何解决
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- Ruby On Rails使用Bootstrap框架
- 利用 Bootstrap 进行快速 Web 开发
- bootstrap分页插件--Bootstrap Paginator的使用备份
- Bootstrap~多级导航(级联导航)的实现效果【附代码】
- Bootstrap多级导航栏(级联导航)的实现代码
- bootstrap兼容IE8 解决办法
- Bootstrap~多级导航(级联导航)的实现
- bootstrap——辅助类和响应式工具类
- Bootstrap~学习笔记索引