|  引入CSS文件

<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-table.css">

|  引入相关库

我们需要引入Jquery库、bootstrap库、以及bootstrap-table.js文件

<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src="bootstrap-table.js"></script>
<-- put your locale files after bootstrap-table.js -->
<script src="bootstrap-table-zh-CN.js"></script>

|  启用Bootstrap Table插件:

官方文档中给出了我们有两种那个方式来启用bootstrap-table插件:

1,通过data属性的方式:

 
<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,通过js的方式:

//只需要HTML中写下table标签,并设置id
<table id="table"></table>

 

 
$('#table').bootstrapTable({
columns: [{
field: 'id',    
title: 'Item ID'
}, {
field: 'name',
title: 'Item Name'
}, {
field: 'price',
title: 'Item Price'
}],
data: [{
id: 1,
name: 'Item 1',
price: '$1'
}, {
id: 2,
name: 'Item 2',
price: '$2'
}]
});
 

也可以通过url获取数据

 
$('#table').bootstrapTable({
url: 'data1.json',
columns: [{
field: 'id',    //与返回值的JSON数据的key值对应
title: 'Item ID'  //列名
}, {
field: 'name',
title: 'Item Name'
}, {
field: 'price',
title: 'Item Price'
}, ]
});
 

Bootstrap-table学习笔记的更多相关文章

  1. .Net MVC+bootstrap Table学习

    一.效果展示 二.使用方法 1).相关css和js的引用 <link href="~/Themes/Bootstrap/css/bootstrap.css" rel=&quo ...

  2. Bootstrap 基础学习笔记(一)

    排版 (1)标题 Bootstrap标题样式进行了以下显著的优化重置: 1.重新设置了margin-top和margin-bottom的值,  h1~h3重置后的值都是20px:h4~h6重置后的值都 ...

  3. bootstrap 新手学习笔记 代码整理

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  4. Bootstrap入门学习笔记(只记录了效果)

    基本头文件 <!DOCTYPE html> <html> <head> <title>Bootstrap 实例</title> <me ...

  5. Boostrap Table学习笔记

    最近要对项目上的table进行调整,让表格能够支持更多的操作,于是接触到了boostrapTable这个插件.研究了一天,记录下学习的内容. Boostrap Table可以支持表的分页及动态显示表的 ...

  6. LUA table学习笔记

    function printT( ... ) for i,v in ipairs(...) do print(i,v) end end t1={} t2={} t3={} table.insert(t ...

  7. Bootstrap 3学习笔记 -栅格

    这是Bootstrap中非常基础一张表,但其实有这么容易掌握和理解吗? (1).对于col-md的div, 默认是垂直排列, 当视口(屏幕或浏览器的宽度)>992px,col-md-1的div块 ...

  8. Bootstrap 新手学习笔记——布局组件

    1.字形图标: <button type="button" class="btn btn-primary btn-lg" style="font ...

  9. Bootstrap新手学习笔记——css

    Css模块: 1.网格系统: class前缀:.col-xs-*,.col-sm-*,.col-md-*,.col-lg-* <div class="container"&g ...

  10. bootstrap table 学习记录

    效果: html代码: <!-- 工具容器 --> <div id="toolbar" class="btn-group"> <b ...

随机推荐

  1. gdb中信号

    信号(Signals) 信号是一种软中断,是一种处理异步事件的方法.一般来说,操作系统都支持许多信号.尤其是UNIX,比较重要应用程序一般都会处理信号.UNIX定义了许 多信号,比如SIGINT表示中 ...

  2. 解决php的交互式命令行不能正常启动的问题兼介绍psysh

    今天在自己的mac电脑上试着启动php的交互式命令行,发现敲下命令后一直卡在提示进入的地方,但没有出现已经进入的提示符,百度了下应该是与readline有关. 于是安装php的readline扩展,在 ...

  3. sql语句之表间字段值复制遇到的一些问题--基于mysql

    好久没来园子了,转眼2017已经到3月份了,前段时间一直忙没时间写博客(其实是自己懒),感觉内心好惭愧.昨天临下班前,技术老大突然对我说要改下表结构,问我能不能实现将一个表的字段值复制到另外一个表的某 ...

  4. 开源PaaS工具CloudFoundry落地阿里云

    原文:https://yq.aliyun.com/articles/292815?utm_content=m_37457 云计算技术的不断成熟和完善,尤其是IaaS平台的不断发展,使得越来越多的企业和 ...

  5. How develop BigData Project in Visual Studio

  6. jQuery调用Asp.Net后台方法

    常用的ajax就不讲了,这里主要是说通过ajax调用asp.net后台的cs文件暴露的方法. 前台: <%@ Page Language="C#" AutoEventWire ...

  7. mysql提示Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist解决方法

    一次重启mysql发现无法启动成功,通过检查mysql日志发现问题并解决了问题. mysql启动失败的日志: [root@nn ~]# tail -n 20 /var/log/mysqld.log 1 ...

  8. vector 去重

    1.使用unique函数: sort(v.begin(),v.end()); v.erase(unique(v.begin(), v.end()), v.end()); //unique()函数将重复 ...

  9. Linux下设置和查看环境变量

    Linux的变量种类 按变量的生存周期来划分,Linux变量可分为两类: 1 永久的:需要修改配置文件,变量永久生效. 2 临时的:使用export命令声明即可,变量在关闭shell时失效. 设置变量 ...

  10. B1048 数字加密

    15/20 #include<bits/stdc++.h> using namespace std; stack<int> s; char a[3]={'J','Q','K'} ...