右侧导航条有目录哟,看着更方便

  • 快速入门
  • 表格构建
  • API简单介绍
  • 主要研究功能介绍

快速入门

最好的资源官方文档
官方文档地址****https://bootstrap-table.com/docs/getting-started/introduction/
Bootstrap Table源码下载地址****https://github.com/wenzhixin/bootstrap-table/archive/master.zip
基本CSS<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.2/dist/bootstrap-table.min.css">
基本JS<script src="https://unpkg.com/bootstrap-table@1.15.2/dist/bootstrap-table.min.js"></script>
注意点:
百科定义:<!DOCTYPE> 声明必须位于 HTML5 文档中的第一行,也就是位于 标签之前。该标签告知浏览器文档所使用的HTML规范。
官方说明: Bootstrap Table需要使用HTML5 doctype。没有它,你会看到一些时髦的不完整造型
快速入门模板,按照这个模板导入文件就可以满足基本需求了

<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Hello, Bootstrap Table!</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.2/dist/bootstrap-table.min.css">
</head>
<body>
<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> <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.2/dist/bootstrap-table.min.js"></script>
</body>
</html>

表格的构建(自动生成表格的方式)

通过数据直接编写(没啥用)

<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>

通过数据接口(可以用) Bootstrap会根据数据和表头data-field自动填充表格

<table
data-toggle="table"
data-url="data1.json">
<thead>
<tr>
<th data-field="id">Item ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>

表格属性通过table内的属性设置(设置属性是Bootstrap Table应用的主要方式)

<table
data-toggle="table"
data-url="data1.json"
data-pagination="true"
data-search="true">
<thead>
<tr>
<th data-sortable="true" data-field="id">Item ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>

通过JavaScript构建(推荐)

<table id="table"></table>
$('#table').bootstrapTable({
url: 'data1.json',
pagination: true,
search: true,
columns: [{
field: 'id',
title: 'Item ID'
}, {
field: 'name',
title: 'Item Name'
}, {
field: 'price',
title: 'Item Price'
}]
})

表格的具体用法API

HTML书写 js书写 含义 默认 例子
data-toggle toggle 无需编写JavaScript即可激活引导表 ‘table’ https://examples.bootstrap-table.com/#welcomes/from-html.html
data-height height 表的高度 undefined https://examples.bootstrap-table.com/#options/table-height.html
data-classes classes 表的class属性,如果没有自己定义,则默认有边框,并且当鼠标悬浮在那一行,背景会变为浅灰色. table table-hover https://examples.bootstrap-table.com/#options/thead-classes.html

太多了就不一一copy了,官方文档是最全的资料。实在看不懂网页翻译,Nothing is impossible

官网API地址https://bootstrap-table.com/docs/api/table-options/
官网实例地址https://examples.bootstrap-table.com/

主要研究功能介绍

1、固定列

需要导入文件

<link rel="stylesheet" src="extensions/fixed-columns/bootstrap-table-fixed-columns.css">
<script src="extensions/fixed-columns/bootstrap-table-fixed-columns.js"></script>

属性

属性 类型 默认值 介绍
fixedNumber Boolean false 是否打开固定列
fixedNumber Number 1 固定几列

该属性位于扩展中,有可能还不成熟,用的时候遇到了列错位问题

2、列可调整大小(就是列可拖动宽度)

需要导入文件

<script src="extensions/resizable/bootstrap-table-resizable.js"></script>

注意 使用这个插件需要依赖于另一个插件
Use Plugin: bootstrap-table-resizable Dependence: jquery-resizable-columns v0.2.3

属性 类型 默认值 介绍 例子
resizable Boolean false 是否打开列可拖动 https://examples.bootstrap-table.com/#extensions/resizable.html

This plugin does not work when data-height is set.
设置data-height时,此插件不起作用。
官网例子源码,点击官网例子左上角View可见

<link href="https://unpkg.com/jquery-resizable-columns@0.2.3/dist/jquery.resizableColumns.css" rel="stylesheet">
<link href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css" rel="stylesheet"> <script src="https://unpkg.com/jquery-resizable-columns@0.2.3/dist/jquery.resizableColumns.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.3/dist/extensions/resizable/bootstrap-table-resizable.min.js"></script> <table id="table"
data-show-columns="true"
data-search="true"
data-show-toggle="true"
data-pagination="true"
data-url="json/data1.json"
data-resizable="true">
<thead>
<tr>
<th data-field="id" data-sortable="true">ID</th>
<th data-field="name" data-sortable="true">Item Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
</tr>
</thead>
</table> <script>
$(function() {
$('#table').bootstrapTable()
})
</script>

3、修改返回后返回原来分页页面(记住原来页面信息)Table Cookie

需要导入文件

<script src="extensions/cookie/bootstrap-table-cookie.js"></script>
属性 类型 默认值 介绍
cookie Boolean false 设置true保存表的状态(其分页位置,排序状态,每页记录)

结语:很多创新性的东西目前都在扩展里,还不是特别稳定,就如固定列,选中一条信息,被固定的几列有明显不同,还有经常发生的一件事就是列错位。暂时还不适用于生产环境

BootStrap Table超好用的表格组件基础入门的更多相关文章

  1. Bootstrap Table 超多列 使用滚动条

    overflow-x: scroll;横向滑动详细讲解 able显示滚动条,要先把table放到一个div中,控制div 属性overflow值为scroll <div style=" ...

  2. [转] BootStrap table增加一列显示序号

    原文地址:https://blog.csdn.net/aboboo5200/article/details/78839208 最近由于项目需要,使用BootStrap table做数据展示,其中要在第 ...

  3. JS组件系列——表格组件神器:bootstrap table

    前言:之前一直在忙着各种什么效果,殊不知最基础的Bootstrap Table用法都没有涉及,罪过,罪过.今天补起来吧.上午博主由零开始自己从头到尾使用了一遍Bootstrap Table ,遇到不少 ...

  4. JS组件系列——表格组件神器:bootstrap table(二:父子表和行列调序)

    前言:上篇 JS组件系列——表格组件神器:bootstrap table 简单介绍了下Bootstrap Table的基础用法,没想到讨论还挺热烈的.有园友在评论中提到了父子表的用法,今天就结合Boo ...

  5. 使用bootstrap table小记(表格组件)

    前言 新的一年悄然到来,生活依旧.最近一周大热的赵雷风,一首<成都>,一首<理想>再次把民谣展示在国人面前.歌词着实写的不错. 理想,你今年几岁 你总是诱惑着年轻的朋友 你总是 ...

  6. [转]JS组件系列——表格组件神器:bootstrap table

    原文地址:https://www.cnblogs.com/landeanfen/p/4976838.html 前言:之前一直在忙着各种什么效果,殊不知最基础的Bootstrap Table用法都没有涉 ...

  7. JS组件系列——表格组件神器:bootstrap table 包含了js对象的定义和对象成员函数的定义

    前言:之前一直在忙着各种什么效果,殊不知最基础的Bootstrap Table用法都没有涉及,罪过,罪过.今天补起来吧.上午博主由零开始自己从头到尾使用了一遍Bootstrap Table ,遇到不少 ...

  8. 【转载】BootStrap表格组件bootstrap table详解

    (转载,来源“脚本之家”,作者不详) 一.Bootstrap Table的引入 关于Bootstrap Table的引入,一般来说还是两种方法: 1.直接下载源码,添加到项目里面来.由于Bootstr ...

  9. JS组件系列——Bootstrap Table 表格行拖拽

    前言:之前一直在研究DDD相关知识,好久没更新JS系列文章了.这两天做了一个简单的业务需求,觉得效果还可以,今天在这里分享给大家,欢迎拍砖~~ 一.业务需求及实现效果 项目涉及到订单模块,那天突然接到 ...

随机推荐

  1. 重拾javaweb(假期后第一次web测试)

    上学期通过十六周的时间,完成了javaweb的项目实践,其中包括很多次的练习以及测试.寒假时间大多用来挥霍,并没有对这些知识进行复习以及进一步的学习,所以在这场考试中,最终以八分的可怜成绩收尾,实在过 ...

  2. 认识vue-cli脚手架

    ps:脚手架系列主要记录我自己(一名前端小白)对脚手架学习的一个过程,如有不对请帮忙指点一二! [抱拳] 作为一名前端开发工程师,平时开发项目大多都离不开一个重要的工具,那就是脚手架.下面让我们来了解 ...

  3. [源码解析] 深度学习分布式训练框架 horovod (18) --- kubeflow tf-operator

    [源码解析] 深度学习分布式训练框架 horovod (18) --- kubeflow tf-operator 目录 [源码解析] 深度学习分布式训练框架 horovod (18) --- kube ...

  4. ThinkPHP3.2.3使用PHPExcel类操作excel导入读取excel

    方法一: 1. 下载PHPExcel并保存在如下位置: 2. 在控制器中引用 vendor("PHPExcel.PHPExcel"); $objReader = \PHPExcel ...

  5. 开源百宝箱《HelloGitHub》第 64 期

    兴趣是最好的老师,HelloGitHub 让你对编程感兴趣! 简介 分享 GitHub 上有趣.入门级的开源项目. HelloGitHub 有实战.教程.黑科技.开源书籍.企业级开源项目,涵盖多种编程 ...

  6. PGSQL基础语句汇总

    一.pgsql里面的数据类型不再介绍:https://www.runoob.com/postgresql/postgresql-data-type.html 二.常用基本语句 2.1.CREATE D ...

  7. Ubuntu21.04 / Linux Mint20.2 安装 TradingView分析软件

    TradingView 是我们经常使用的一个分析工具!在Linux 下安装桌面版,就可以爽快的用起来了,目前是Beta测试版,相信很快就会有正式版的 1.打开终端,执行下列命令,更新系统到最新 sud ...

  8. SuperEdge 高可用云边隧道有哪些特点?

    作者 作者李腾飞,腾讯容器技术研发工程师,腾讯云TKE后台研发,SuperEdge核心开发成员. 背景 在边缘集群中,边缘端和云端为单向网络,云端无法主动连接边缘端,常见的解决方案是边缘端主动和云端( ...

  9. Maven项目思考&实战

    参考了网络上很多文章, 特此感谢. Maven项目规范 同一项目中所有模块版本保持一致 子模块统一继承父模块的版本 统一在顶层模块Pom的节中定义所有子模块的依赖版本号,子模块中添加依赖时不要添加版本 ...

  10. ListPopupWindow和Popupwindow的阴影相关问题demo总结

    Popupwindow: 优点:可以通过setBackgroundDrawable()来重新设置阴影. 缺点:当AnchorView是可移动的,比如移动到屏幕的左右边界.左下角.右下角时,Popupw ...