bootstrap-table的简单使用
先上效果图:

第一步:引用bootstrap-table的样式和js。
 @Styles.Render("~/assets/css/bootstrap.css")
 @Styles.Render("~/Content/bootstrap-table.min.css")
 @Scripts.Render("~/assets/js/jquery-1.11.1.min.js")
 @Scripts.Render("~/Scripts/bootstrap-table.min.js")
 @Scripts.Render("~/Scripts/bootstrap-table-zh-CN.min.js")
第二步:在页面上放一个table标签。
<div class="row">
<table class="table table-striped table-hover table-small-font" id="reportTable"></table>
</div>
第三步:在加载或者搜索事件中处理js代码
         var loginname = $('#txt_loginname').val();
         var realname = $('#txt_realname').val();
         show_loading_bar(50);
         startup();
         $.ajax({
             url: "@Url.Action("QueryUserList", "System")",
             method: 'GET',
             dataType: 'json',
             cache: false,
             async: false,
             data: {
                 username: loginname,
                 realname: realname
             },
             success: function (resp) {
                 show_loading_bar(100);
                 shutdown();
                 if (resp.Status == 1) {
                     var data = [];
                     if (resp.Data.length > 0) {
                         data = resp.Data;
                     }
                     $('#reportTable').bootstrapTable('destroy');    //先销毁才可再次初始化
                     $('#reportTable').bootstrapTable({
                         method: 'get',
                         clickToSelect: true,
                         pagination: true,  //是否分页
                         //showPaginationSwitch: true, //显示分页切换按钮
                         pageList: [10, 25, 50, 100],
                         pageSize: 10,
                         pageNumber: 1,
                         uniqueId: 'dl_uhid', //将index列设为唯一索引
                         striped: true,
                         //search: true,  //显示检索框
                         columns: [
                             {
                                 field: "dl_uhid", title: "用户ID", align: "center"
                             },
                             { field: "dl_username", title: "用户账户", align: "center", sortable: true },
                             {
                                 field: "dl_name", title: "用户姓名", align: "center", sortable: true
                             },
                             {
                                 field: "dl_degree", title: "职位", align: "center"
                             },
                             { field: "dl_duty", title: "职称", align: "center", sortable: true },
                             { field: "dl_department", title: "科室", align: "center", sortable: true },
                             {
                                 field: "", title: "操作", align: "center", formatter: function (value, row, rowIndex) {
                                     var strHtml = '<a class="btn-pink" href="javascript:void(0);" onclick="ShowDetail(\'' + row["dl_uhid"] + '\');"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>    <a class="btn-red" href="javascript:void(0);" onclick="Delete(\'' + row["dl_uhid"] + '\');"><i class="fa fa-trash" aria-hidden="true"></i></a>';
                                     return strHtml;
                                 }
                             }
                         ],
                         data: data
                     });
                     $('#reportTable').bootstrapTable('hideColumn', 'dl_uhid');
                 }
                 else {
                     toastr.error(resp.Message);
                 }
             }
         });
至此,bootstrap-table的简单使用就完成了,初来乍到,简单总结了一下,分享给请大家,写的不好请多多见谅,转载请注明出处,谢谢!!
bootstrap-table的简单使用的更多相关文章
- bootstrap table 的简单Demo
		
暂时够用,不够用再补充 T_T script: <link rel="stylesheet" href="lib/bootstrap.min.css"&g ...
 - bootstrap table 前后端分页(超级简单)
		
前端分页:数据库查询所有的数据,在前端进行分页 后端分页:每次只查询当前页面加载所需要的那几条数据 下载bootstrap 下载bootstrap table jquery谁都有,不说了 项目结构:T ...
 - Bootstrap table的一些简单使用总结
		
在GitHub上Bootstrap-table的源码地址是:https://github.com/wenzhixin/bootstrap-table Bootstrap-table的文档地址:http ...
 - bootstrap Table API和一些简单使用方法
		
官网: http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/ 后端分页问题:后端返回”rows”.“”total,这样才能重新赋值 ...
 - JS组件系列——表格组件神器:bootstrap table
		
前言:之前一直在忙着各种什么效果,殊不知最基础的Bootstrap Table用法都没有涉及,罪过,罪过.今天补起来吧.上午博主由零开始自己从头到尾使用了一遍Bootstrap Table ,遇到不少 ...
 - JS组件系列——表格组件神器:bootstrap table(二:父子表和行列调序)
		
前言:上篇 JS组件系列——表格组件神器:bootstrap table 简单介绍了下Bootstrap Table的基础用法,没想到讨论还挺热烈的.有园友在评论中提到了父子表的用法,今天就结合Boo ...
 - JS组件系列——表格组件神器:bootstrap table(三:终结篇,最后的干货福利)
		
前言:前面介绍了两篇关于bootstrap table的基础用法,这章我们继续来看看它比较常用的一些功能,来个终结篇吧,毛爷爷告诉我们做事要有始有终~~bootstrap table这东西要想所有功能 ...
 - JS组件系列——Bootstrap Table 表格行拖拽
		
前言:之前一直在研究DDD相关知识,好久没更新JS系列文章了.这两天做了一个简单的业务需求,觉得效果还可以,今天在这里分享给大家,欢迎拍砖~~ 一.业务需求及实现效果 项目涉及到订单模块,那天突然接到 ...
 - JS组件系列——Bootstrap Table 表格行拖拽(二:多行拖拽)
		
前言:前天刚写了篇JS组件系列——Bootstrap Table 表格行拖拽,今天接到新的需要,需要在之前表格行拖拽的基础上能够同时拖拽选中的多行.博主用了半天时间研究了下,效果是出来了,但是感觉不尽 ...
 - Bootstrap Table使用分享
		
版权声明:本文为博主原创文章,未经博主允许不得转载. 最近客户提出需求,想将原有的管理系统,做下优化,通过手机也能很好展现,想到2个方案: a方案:保留原有的页面,新设计一套适合手机的页面,当手机访问 ...
 
随机推荐
- Flask-SQLAlchemy操作
			
Flask-SQLAlchemy SQLAlchemy 一. 介绍 SQLAlchemy是一个基于Python实现的ORM框架.该框架建立在 DB API之上,使用关系对象映射进行数据库操作,简言 ...
 - C之指针
			
什么是指针 * 指针变量:用来存储某种数据在内存中的地址.* 世面上书籍一般把指针和指针变量的概念混在一起了.市面上的书籍说的指针指的就是指针变量 Ø *号的三种含义1. 两个数相乘int i =5; ...
 - 配置Xmanager远程登录
			
1.修改/etc/gdm/custom.conf文件找到下面的语句:[security]AllowRemoteRoot=true[xdmcp]Enable=true修改custom.conf后,必须重 ...
 - MySQL问题:Access denied for user 'mysql'@'localhost'
			
deep@deep-PC:~$ sudo mysql -uroot -p mysql> update mysql.user set authentication_string=PASSWORD( ...
 - PJzhang:docker基础知识的2个疗程-one
			
猫宁!!! 参考:http://virtual.51cto.com/art/201805/572135.htm https://www.cnblogs.com/rkit/p/9237696.html ...
 - 关于LuckyE博客的前言
			
第一次开始尝试怎么写博客,也不知道写点什么好...... 开始写博客的原因其实很多,主要原因是因为最近考出cisp-pte证书,然后前几天电话面试某比较有名的安全公司(x盟)的渗透测试工程师实习生被撸 ...
 - http与https的主要区别
			
HTTP与HTTPS的主要区别如下: 1.https协议需要到ca申请证书,一般免费证书较少,因而需要一定费用. 2.http是超文本传输协议,信息是明文传输,https则是具有安全性的ssl加密传输 ...
 - 洛谷 题解 P2676 【超级书架】
			
题解 P2676 [超级书架] 这题就只是一个从大到小的排序而已,用"sort"函数 再用"while"判断奶牛塔的高度是否比书架高度要高 送上代码: #inc ...
 - OLTP和 OLAP区别
			
联机事务处理OLTP(on-line transaction processing) 主要是执行基本日常的事务处理,比如数据库记录的增删查改.比如在银行的一笔交易记录,就是一个典型的事务. OLTP的 ...
 - [CF1146D]Frog Jumping_exgcd_堆优化dij
			
Frog Jumping 题目链接:http://codeforces.com/contest/1146/problem/D 数据范围:略. 题解: 首先发现,如果$x\ge a +b$,那么所有的$ ...