引入bootstrap-paginator.js

<table class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="sample_2_info">
<thead>
<tr role="row">
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
<th tabindex="0" aria-label="">
**
</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
<div class="paging-toolbar">
<ul id="grid_paging_part"></ul>
</div>
<script>
$(function () {
loadTables(1, 10);
}); function loadTables(startPage, pageSize) {
$("#tableBody").html("");
$.ajax({
type: "GET",
url: "/Transaction/GetRecordList?startPage=" + startPage + "&pageSize=" + pageSize,
success: function (data) {
$.each(data.rows, function (i, item) {
var tr = "<tr>";
tr += "<td>" + item.orderId + "</td>";
tr += "<td>" + item.appName + "</td>";
tr += "<td>" + item.realName + "</td>";
tr += "<td>" + item.accountTypeName + "</td>";
tr += "<td>" + item.transAmount + "</td>";
tr += "<td>" + item.transTime.replace("T", " ") + "</td>";
if (item.transType == '1') {
tr += "<td>**</td>";
}
if (item.transType == '2') {
tr += "<td>**</td>";
}
if (item.flag == '0') {
tr += "<td>**</td>";
}
else {
tr += "<td>**</td>";
}
tr += "</tr>";
$("#tableBody").append(tr);
})
var elment = $("#grid_paging_part"); //分页插件的容器id
if (data.rowCount > 0) {
var options = { //分页插件配置项
bootstrapMajorVersion: 3,
currentPage: startPage, //当前页
numberOfPages: data.rowsCount, //总数
totalPages: data.pageCount, //总页数
shouldShowPage: function (type, page, current) {
var result = !0;
switch (type) {
case "first":
result = 1 !== current;
break;
case "prev":
result = 1 !== current;
break;
case "next":
result = current !== this.totalPages;
break;
case "last":
result = current !== this.totalPages;
break;
case "page":
result = !0
}
return result
},
itemTexts: function (type, page, current) {//设置显示的样式,默认是箭头
switch (type) {
case "first":
return "首页";
case "prev":
return "上一页";
case "next":
return "下一页";
case "last":
return "末页";
case "page":
return page;
}
},
onPageChanged: function (event, oldPage, newPage) { //页面切换事件
loadTables(newPage, pageSize);
}
}
elment.bootstrapPaginator(options); //分页插件初始化
}
}
})
}; </script>

前端分页插件bootstrapPaginator的使用的更多相关文章

  1. Jquery前端分页插件pagination同步加载和异步加载

    上一篇文章介绍了Jquery前端分页插件pagination的基本使用方法和使用案例,大致原理就是一次性加载所有的数据再分页.https://www.jianshu.com/p/a1b8b1db025 ...

  2. 前端分页插件pagination

    摘要: 最近在开发项目中又用到了前端分页,以前也做过,为了方便以后使用所以将他封装成第三方插件,不依赖任何库.网上已经有很多插件,问什么还要自己造轮子? 自己写的扩展性高 不依赖任何库 作为一次技术沉 ...

  3. 一款基于Bootstrap的js分页插件bootstrap-paginator使用实例

    Bootstrap Paginator是一款基于Bootstrap的js分页插件,功能很丰富.它提供了一系列的参数用来支持用户的定制,提供了公共的方法可随时获得插件状态的改变,以及事件来监听用户的动作 ...

  4. Jquery前端分页插件pagination使用

    插件描述:JqueryPagination是一个轻量级的jquery分页插件.只需几个简单的配置就可以生成分页控件.并且支持ajax获取数据,自定义请求参数,提供多种方法,事件和回调函数,功能全面的分 ...

  5. angularJS前端分页插件

    首先在项目中引入 分页插件的 js 和 css: 在html页面引入 相关js 和 css: 在控制器中引入分页插件中定义的 module[可以打开pagination.js查看,可以看到 其实,在插 ...

  6. 品优购商城项目(二)mybatis分页插件

    品优购商城项目第二天,使用mybatis分页插件实现分页.主要实现的是 SSM整合mybatis分页. 一.引用mybatis分页插件 SqlMapConfig.xml <?xml versio ...

  7. 前端分页神器,jquery grid的使用(前后端联调),让分页变得更简单。

    jquery grid 是一款非常好用的前端分页插件,下面来讲讲怎么使用. 首先需要引入jquery grid 的CSS和JS (我们使用的是bootstrap的样式) 下面我们通过一个例子来讲解,需 ...

  8. bootstrap-paginator 分页插件笔记

    [MVC]bootstrap-paginator 分页插件笔记   bootstrap-paginator基于bootstrap框架,使用起来非常简单.官网:http://harttle.github ...

  9. Bootstrap分页插件:bootstrap-paginator

    今天和大家分享一个Bootstrap的分页插件:bootstrap-paginator. 插件地址: https://github.com/lyonlai/bootstrap-paginator 先看 ...

随机推荐

  1. Windows Services(NT)

    本文主要记录什么是Windows Service,及其主要组成?并通过一个列子来创建一个Windows Services,同时,记录几个在查资料碰到的问题. Windows Services全文简称N ...

  2. Codeforce 834A - The Useless Toy

    Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kin ...

  3. [转载]SQL Server中的事务与锁

    了解事务和锁 事务:保持逻辑数据一致性与可恢复性,必不可少的利器. 锁:多用户访问同一数据库资源时,对访问的先后次序权限管理的一种机制,没有他事务或许将会一塌糊涂,不能保证数据的安全正确读写. 死锁: ...

  4. hibernate文档头的不同版本

    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "h ...

  5. org.springframework.jdbc.UncategorizedSQLException

    org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException fo ...

  6. Python - mouse clicks and keystrokes on a background window

    https://stackoverflow.com/questions/43965437/python-mouse-clicks-and-keystrokes-on-a-background-wind ...

  7. django 存在则忽略, 不存在则创 TagSheet.objects.get_or_create(tag='test')

    django 存在则忽略, 不存在则创 TagSheet.objects.get_or_create(tag='test')

  8. css链接link

    链接可以使用任何css属性,包括字体.颜色.背景等等. 链接有四个状态,可在四个状态时设置不同的属性 a:link - 正常,未访问过的链接 a:visited - 用户已访问过的链接 a:hover ...

  9. JavaScript实现表单验证_02

    注册3次错误,最终的结果: 代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  10. ERROR 1526 (HY000): Table has no partition for value xxx

    最近,我们有些功能需要使用到基于多个字段的分区,需要同时支持oracle/mysql,但是开发人员又希望尽可能少的改动业务代码,也不愿意使用多列分区,在oracle 11g之前,不支持多列分区(12. ...