Bootstrap Table使用整理(一)

相关阅读:

Bootstrap Table使用整理(二)  http://www.jb51.net/article/115791.htm

Bootstrap Table使用整理(三)  http://www.jb51.net/article/115795.htm

Bootstrap Table使用整理(四)之工具栏 http://www.jb51.net/article/115798.htm

Bootstrap Table使用整理(五)之分页组合查询 http://www.jb51.net/article/115785.htm

一、Bootstrap Table相关整理

基于 Bootstrap 的 jQuery 表格插件,通过简单的设置,就可以拥有强大的单选、多选、排序、分页,以及编辑、导出、过滤(扩展)等等的功能。

1.官网地址:

http://bootstrap-table.wenzhixin.net.cn/zh-cn/    Git源代码地址:https://github.com/wenzhixin/bootstrap-table

基础简介:

http://bootstrap-table.wenzhixin.net.cn/zh-cn/getting-started/

使用示例:

http://bootstrap-table.wenzhixin.net.cn/zh-cn/examples/

API文档:

http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/

Bootstrap Table的有点使用简单,美观整洁,支持CardView等特点

二、简单使用实例

基础引用

<link href="~/lib/bootstrap-table/dist/bootstrap-table.css" rel="external nofollow" rel="stylesheet" />
<script src="~/lib/bootstrap-table/dist/bootstrap-table.js"></script>
<script src="~/lib/bootstrap-table/src/locale/bootstrap-table-zh-CN.js"></script> 

1.data-toggle="table"  无需JavaScript启用bootstrap table

<p>通过Data属性的方式,无需编写JavaScript启用bootstrap table, 设置 data-toggle="table" 即可</p>
<div class="alert alert-danger">
 <p>1.这种方式不太常用,因为分页不方便</p>
</div>
<table data-toggle="table">
 <thead>
  <tr>
   <th>Item ID</th>
   <th>Item Name</th>
   <th>Item Price</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>1</td>
   <td>Item 1</td>
   <td>$1</td>
  </tr>
  <tr>
   <td>2</td>
   <td>Item 2</td>
   <td>$2</td>
  </tr>
 </tbody>
</table> 

2.使用data-url指定远程数据,特别说明,在使用远程数据的时候,在ajax请求期间,表格内容显示加载中...,

<p>可以通过设置远程url 如:data-url="data1.json" ,自动加载远程数据</p>
<div class="alert alert-danger">
 <p>1.这种方式对于分页不太方便</p>
 <p>2.BootstrapTable 对于字段中为空,自动替换成'-'</p>
</div>
<table data-toggle="table" data-url="@Url.Action("GetStudent","DataOne")">
 <thead>
  <tr>
   <th data-field="sno">编号</th>
   <th data-field="sname">姓名</th>
   <th data-field="ssex">性别</th>
   <th data-field="sbirthday">生日</th>
   <th data-field="class">课程编号</th>
  </tr>
 </thead>
</table> 

3.data-classes 属性指定表格的样式,

特别说明:表头和属性的指定方式有两种,一种DOM中定义,一种在Js的参数中定义

<table id="table1"
  data-classes="table table-hover table-condensed"></table>
[javascript] view plain copy print?
//data-classes 可以设置样式
/*
* table-condensed 设置内容框浓缩
*/
$('#table1').bootstrapTable({
 columns: [
  { field: 'sno', title: '学生编号' },
  { field: 'sname', title: '学生姓名' },
  { field: 'ssex', title: '性别' },
  { field: 'sbirthday', title: '生日' },
  { field: 'class', title: '课程编号' },
 ],
 url:'@Url.Action("GetStudent","DataOne")'
}); 

table-condensed 表格紧凑样式显示如下:

以上所述是小编给大家介绍的Bootstrap Table使用整理(一),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!

(0)

相关推荐

  • Bootstrap Table使用整理(五)之分页组合查询

    推荐阅读: Bootstrap Table使用整理(一) http://www.jb51.net/article/115789.htm Bootstrap Table使用整理(二)  http://www.jb51.net/article/115791.htm Bootstrap Table使用整理(三)  http://www.jb51.net/article/115795.htm Bootstrap Table使用整理(四)之工具栏 http://www.jb51.net/article/1

  • Bootstrap table使用方法详细介绍

    bootstrap-table是一个非常好用的表格插件,提供了很多工具及分页.搜索等功能. 首先我们需要下面几个文件, <span style="font-size:18px;"><!-- bootstrap table --> <script type="text/javascript" src="${pageContext.request.contextPath}/res/jquery-1.10.2/jquery.js&q

  • Bootstrap Table使用整理(二)

    相关阅读: Bootstrap Table使用整理(一) http://www.jb51.net/article/115789.htm Bootstrap Table使用整理(三)  http://www.jb51.net/article/115795.htm Bootstrap Table使用整理(四)之工具栏 http://www.jb51.net/article/115798.htm Bootstrap Table使用整理(五)之分页组合查询 http://www.jb51.net/art

  • DataTables+BootStrap组合使用Ajax来获取数据并且动态加载dom的方法(排序,过滤,分页等)

    Datatables是一款jquery表格插件.它是一个高度灵活的工具,可以将任何HTML表格添加高级的交互功能. 主要功能 分页,即时搜索和排序 几乎支持任何数据源:DOM, javascript, Ajax 和 服务器处理 支持不同主题 DataTables, jQuery UI, Bootstrap, Foundation 各式各样的扩展: Editor, TableTools, FixedColumns -- 丰富多样的option和强大的API 支持国际化 超过2900+个单元测试 免

  • BootstrapTable refresh 方法使用实例简单介绍

    本文就bootstrapTable refresh 方法如何传递参数做简单举例说明.下面代码中,一个table,一个button,单击button会触发刷新表格操作. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="../libs/bootstrap

  • 值得分享的Bootstrap Table使用教程

    bootstrap-table是在bootstrap-table的基础上写出来的,专门用于显示数据的表格插件.而bootstrap是来自 Twitter,是目前最受欢迎的前端框架.Bootstrap 是基于HTML.CSS.JAVASCRIPT 的,具有简便灵活,快速前端开发的优势.对与bootstrap在此就不在叙述. jquery ,bootstrap ,bootstrap-table 三者之间的关系.bootstrap很多部分代码涉及到了jquery的,也就是说 bootstrap是依赖j

  • Bootstrap Table使用整理(三)

    相关阅读: Bootstrap Table使用整理(一) http://www.jb51.net/article/115789.htm Bootstrap Table使用整理(二)  http://www.jb51.net/article/115791.htm Bootstrap Table使用整理(四)之工具栏 http://www.jb51.net/article/115798.htm Bootstrap Table使用整理(五)之分页组合查询 http://www.jb51.net/art

  • Bootstrap Table使用整理(四)之工具栏

    相关阅读: Bootstrap Table使用整理(一) http://www.jb51.net/article/115789.htm Bootstrap Table使用整理(二)  http://www.jb51.net/article/115791.htm Bootstrap Table使用整理(三)  http://www.jb51.net/article/115795.htm Bootstrap Table使用整理(五)之分页组合查询 http://www.jb51.net/articl

  • BootStrap table使用方法分析

    本文实例为大家分享了BootStrap table的使用方法,供大家参考,具体内容如下 bootstrap table git address:https://github.com/wenzhixin/bootstrap-table 引入文件 <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css"/> <link rel="

  • Bootstrap Table使用整理(一)

    相关阅读: Bootstrap Table使用整理(二)  http://www.jb51.net/article/115791.htm Bootstrap Table使用整理(三)  http://www.jb51.net/article/115795.htm Bootstrap Table使用整理(四)之工具栏 http://www.jb51.net/article/115798.htm Bootstrap Table使用整理(五)之分页组合查询 http://www.jb51.net/ar

  • BootStrap table删除指定行的注意事项(笔记整理)

    这里一定要做一个笔记,这个问题花了好几个小时,问题虽小,但是从中获得一定经验. 问题:对于table指定行的数据进行删除,仅仅是前端实现! 方法有两种: 1.使用官方文档的数据(反正我试了2个小时都不行,如有大神请指导下):使用events和operate相结合的方式 2.不使用events,在formatter里面定义事件的实现. 上面的例子只是一个细节点,bootstrap-table是一个基于Bootstrap的jQuery插件,可以实现从数据库中提取数据到前端进行相应操作的功能,很好用!

  • Bootstrap table分页问题汇总

    首先非常感谢作者针对bootstrap table分页问题进行详细的整理,并分享给了大家,希望通过这篇文章可以帮助大家解决Bootstrap table分页的各种问题,谢谢大家的阅读. 问题1 :服务器端取不到form值,querystring没有问题, 但是request.form取不到值 解决:这是ajax的问题,原代码使用原生的ajax.   1可以用读流文件解决.2 如果想用request.form 方式,设置  contentType: "application/x-www-form-

  • Bootstrap Table 删除和批量删除

    一条记录可以看做一条数据的数组 1      Html 1.1  批量选择框 1.2  单个删除 2      bootStarp 2.1  批量获得 获得选择的数据 //批量删除 function deleteUserList() { //获取所有被选中的记录 var rows = $("#user").bootstrapTable('getSelections'); if (rows.length== 0) { alert("请先选择要删除的记录!"); ret

  • Bootstrap table右键功能实现方法

    最近遇到有一个需求,需要在Bootstrap table上使用右键.网上搜了半天没有找到,最后发现Bootstrap table不支持右键(官方文档给出的答案 https://github.com/wenzhixin/bootstrap-table/issues/241 ). 本文介绍使用contextMenu插件实现Bootstrap table右键功能. 代码(test.html): <!DOCTYPE html> <html lang="en"> <

随机推荐