引入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. navicat 连接postgresql报错pg_hba.conf

    PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常: org.postgresql.util.PSQLException: FATAL: ...

  2. 基于jquery、bootstrap的数据验证插件bootstrapValidator使用

    实时验证用户名是否存在,密码不能和用户名相同,两次密码需要相同,提交之后需要验证返回值: <form id="defaultForm" role="form&quo ...

  3. The Little Prince-11/27

    The Little Prince-11/27    The little boy gradually realized that it is tiresome for children to be ...

  4. 【js】关于闭包和匿名函数

    关于js闭包.之前我一直以为是匿名函数,以为封闭式的创建即执行销毁就是闭包,其实这是匿名函数,不一样的.也没有闭包的使用经验. 后来去网上查了下才知道,闭包的意思是:函数内部还有函数,返回一个函数,内 ...

  5. game to refactor for refactor

    first step, only aim to work. it works, but i have not seen the necessaty to use class yet. my quest ...

  6. sqlite3增删改查简单封装

    import sqlite3 class DBTool(object): def __init__(self): """ 初始化函数,创建数据库连接 "&quo ...

  7. Pytorch-学习记录 卷积操作 cnn output_channel, etc.

    参考资料: pytorch中文文档 http://pytorch-cn.readthedocs.io/zh/latest/

  8. Docker学习笔记之通过 Dockerfile 创建镜像

    0x00 概述 由于 Docker 镜像的结构优势,使它的占用空间远小于普通的虚拟机镜像,而这就大幅减少了 Docker 镜像在网络或者其他介质中转移所花费的时间,进而提高了我们进行迁移部署的效率.不 ...

  9. Tensorflow学习笔记01

    Tensorflow官方网站:http://tensorflow.org/ 极客学院Tensorflow中文版:http://wiki.jikexueyuan.com/project/tensorfl ...

  10. css文本样式text、字体样式font

    文本样式text 1.文本颜色color 例如h1 {color:red;} 2.文本方向direction,不常用 默认ltr从左到右,rtl表示从右到左 3.文本水平对齐方式text-align ...