利用BootStrap Table插件实现自己的弹出框分页。
参考链接1:
官网:http://bootstrap-table.wenzhixin.net.cn/zh-cn/home/
开始使用:http://bootstrap-table.wenzhixin.net.cn/zh-cn/getting-started/
文档:http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
参考链接2:https://www.cnblogs.com/wlandwl/p/bootstrap_table.html
1、第一步、首先,先将基本数据信息以table分页展示的出来。(即非弹出框分页的数据,以table分页的方式展示出来)。
<div style="width:100%; padding: 10px;">
<table id="tablewrap1"
data-toggle="table"
data-locale="zh-CN"
data-ajax="ajaxRequest"
data-single-select="true"
data-side-pagination="server" //服务端分页设置:在配置文件中设置分页方式为服务器分页。 分页方式:client客户端分页,server服务端分页(*)
data-striped="true" //设置为 true 会有隔行变色效果。
data-pagination="true" //是否支持分页
data-pagination-first-text="首页"
data-pagination-pre-text="上一页"
data-pagination-next-text="下一页"
data-pagination-last-text="末页" class="fline-show-when-ready"
data-show-jumpto="true">
<thead>
<tr>
<th data-field="id" data-formatter="idFormatter" data-width="">xx编号</th>
<th data-field="name">xx名称</th>
<th data-field="code">xx性别</th>
<th data-field="accessType" data-formatter="formatAccessType">xx年龄</th>
<th data-field="versionTag">xx生日</th>
<th data-field="updateDate" data-formatter="formatDate">xx时间</th>
<th data-field="status" data-formatter="formatStatus">xx地址</th>
<th data-field="operate" data-formatter="opFormatter">xx操作</th>
</tr>
</thead>
</table>
</div>
2、第二步、先将基本数据信息以table分页展示的出来,使用的ajax将数据查询出来,在上面所示的table展示出来。
function ajaxRequest(params) {
var pageSize = params.data.limit;
var pageNum = params.data.offset/pageSize + ;
index = params.data.offset + ;
var sort = params.data.sort? params.data.sort : "id";
var order = params.data.order? params.data.order : "desc";
var datas;
var items;
$.ajax({
type:'POST',
url:'xxxAction!selectStudent.action?pageNum=' + pageNum + '&pageSize=' + pageSize,
dataType:'json',
async:true,
data:$('#searchForm').serialize(),
error: function(request, textStatus, errorThrown) {
fxShowAjaxError(request, textStatus, errorThrown);
},
success:function(data){
datas = data.result;
if(datas != null) {
count = datas.count;
}
items = datas.items?datas.items:[];
params.success({
total: count,
rows: items
});
params.complete();
}
});
}
3、第三步、第一步<th data-field="operate" data-formatter="opFormatter">xx操作</th> 可以使用如下的方法,点击xx操作的,然后可以弹出弹出框分页信息。
function opFormatter(value,row) {
var tmp="'"+row.code+"'";
var name="'"+row.name+"'";
return '<a href="javascript:void(0)" onclick="getxxxDetails('+tmp+","+name+')">点击弹出框分页</a>';
}
如下是弹出框的确定和关闭。
function getxxxDetails(code,name){
$("#tablewrap2").bootstrapTable("selectPage",);
initCatalogTable(code);
$("#tenantCatalogTablediv").dialog({
title : name+"xxx",
width : "",
'class' : "mydialog",
onClose : function() {
$(this).dialog("close");
}
,buttons : {
"关闭" : function() {
$(this).dialog("close");
}
}
});
}
4、第四步、弹出框分页的table如下所示。
<div style="display: none;">
<div style="width: 850; padding-top: 8px;" align="left" id="tenantCatalogTablediv" >
<table id="tablewrap2"
data-toggle="table"
data-locale="zh-CN"
data-single-select="true"
data-click-to-select="false"
data-side-pagination="client" //服务端分页设置:在配置文件中设置分页方式为服务器分页。 分页方式:client客户端分页,server服务端分页(*)
data-striped="true"
data-pagination="true"
data-pagination-first-text="首页"
data-pagination-pre-text="上一页"
data-pagination-next-text="下一页"
data-pagination-last-text="末页"
>
<thead>
<tr>
<th data-field="url" data-formatter="paramsMatter">xx地址</th>
<th data-field="resultCode" >xx姓名</th>
<th data-field="resultMsg" data-formatter="paramsResultMsgr">xx性别</th>
<th data-field="createTime" data-formatter="formatDate">xx年龄</th>
</tr>
</thead>
</table>
</div>
</div>
5、第五步、第四步弹出框分页的table使用如下ajax加载出数据。进行Bootstrap Table 数据绑定。
function initCatalogTable(code){
$.ajax({
type : "POST",
url : 'xxxAction!selectTeacher.action',
data : {'code' : code},
async : false,
error : function(request, textStatus,errorThrown) {
fxShowAjaxError(request, textStatus,errorThrown);
},
success : function(data) {
data=data.result;
if(data==null){
$("#tablewrap2").bootstrapTable('load', []);
return;
}
$('#tablewrap2').bootstrapTable('load', data);
}
});
}
待续......
利用BootStrap Table插件实现自己的弹出框分页。的更多相关文章
- Bootstrap -- 插件: 提示工具、弹出框、 警告框消息
Bootstrap -- 插件: 提示工具.弹出框. 警告框消息 1. 提示工具(Tooltip)插件:根据需求生成内容和标记. 使用提示工具: <!DOCTYPE html> <h ...
- JS组件系列——Bootstrap寒冬暖身篇:弹出框和提示框效果以及代码展示
前言:对于Web开发人员,弹出框和提示框的使用肯定不会陌生,比如常见的表格新增和编辑功能,一般常见的主要有两种处理方式:行内编辑和弹出框编辑.在增加用户体验方面,弹出框和提示框起着重要的作用,如果你的 ...
- [Js插件]使用JqueryUI的弹出框做一个“炫”的登录页面
引言 查看项目代码的时候,发现项目中用到JqueryUi的弹出框,可拖拽,可设置模式对话框,就想着使用它弄一个登录页面. 弹出框 在Jquery Ui官网可定制下载弹出框,下载和弹出框下载相关的js文 ...
- Bootstrap方法为页面添加一个弹出框
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- bootstrap的编辑标记 angularjs input 弹出框
.html <div> {{instance.description}} <span class="glyphicon glyphicon-pencil btn-link& ...
- vue.js 利用组件之间通讯,写一个弹出框例子
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 玩转Bootstrap(JS插件篇)-第1章 模态弹出框 :1-1导入JavaScript插件
导入JavaScript插件 Bootstrap除了包含丰富的Web组件之外,如前面介绍的下拉菜单.按钮组.导航.分页等.他还包括一些JavaScript的插件. Bootstrap的JavaScri ...
- 第二百四十六节,Bootstrap弹出框和警告框插件
Bootstrap弹出框和警告框插件 学习要点: 1.弹出框 2.警告框 本节课我们主要学习一下 Bootstrap 中的弹出框和警告框插件. 一.弹出框 弹出框即点击一个元素弹出一个包含标题和内容的 ...
- Bootstrap:弹出框和提示框效果以及代码展示
前言:对于Web开发人员,弹出框和提示框的使用肯定不会陌生,比如常见的表格新增和编辑功能,一般常见的主要有两种处理方式:行内编辑和弹出框编辑.在增加用户体验方面,弹出框和提示框起着重要的作用,如果你的 ...
随机推荐
- 题解 P1601 【A+B Problem(高精)】
P1601 A+B Problem(高精) 题目描述 高精度加法,x相当于a+b problem,b不用考虑负数. 输入输出格式 输入格式: 分两行输入a,b<=10^500 输出格式: 输出只 ...
- Windows 10 Update
services.msc Windows Update
- python之常用模块二(hashlib logging configparser)
摘要:hashlib ***** logging ***** configparser * 一.hashlib模块 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 摘要算法 ...
- [十二省联考2019]字符串问题——后缀自动机+parent树优化建图+拓扑序DP+倍增
题目链接: [十二省联考2019]字符串问题 首先考虑最暴力的做法就是对于每个$B$串存一下它是哪些$A$串的前缀,然后按每组支配关系连边,做一遍拓扑序DP即可. 但即使忽略判断前缀的时间,光是连边的 ...
- mpvue——小程序修改input的placehold样式
前言 官方地址 https://developers.weixin.qq.com/miniprogram/dev/component/input.html 用placeholder-class的时候没 ...
- android实用软件tasker应用设置
设置连接wifi和充电两个调试都满足的情况下打开同步和psiphon3:在端任意wifi是断开或断电时同步和关掉psiphon3. 其他没有问题去到关掉psiphon3时出现小意外,不能直接关闭程序( ...
- Springboot 4.Springboot 集成SwaggerUi
SwaggerUi就是自动生成接口文档的这么一个类似于插件的工具,可以直接访问接口. 首先打开pom文件,将插件引进来,然后增加一个属性<properties>,用来设置版本号的,然后直接 ...
- mybatis 模糊查询 like的三种方式
第一种 public void selectBykeyWord(String keyword) { String id = "%" + keyword + "%" ...
- 069、Calico的默认连通性(2019-04-12 周五)
参考https://www.cnblogs.com/CloudMan6/p/7536746.html Calico 跨主机连通性测试 root@host1:~# docker exec bbo ...
- A fine property of the convective terms of axisymmetric MHD system, and a regularity criterion in terms of $\om^\tt$
In [Zhang, Zujin; Yao, Zheng-an. 3D axisymmetric MHD system with regularity in the swirl component o ...