1 Star 3 Fork 1

lizhun/bootstrap-table-example-study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
7.html 4.51 KB
一键复制 编辑 原始数据 按行查看 历史
lizhun 提交于 2020-01-03 15:25 . readme优化
<!DOCTYPE html>
<html>
<head>
<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" type="text/css" href="./node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="./node_modules/bootstrap-table/dist/bootstrap-table.min.css">
<link rel="stylesheet" type="text/css" href="./node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="./css/style.css">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>转义显示、详情显示、自定义toolbar</h5>
</div>
<div class="ibox-content">
<div class="toolbar">
<div class="form-inline" role="form">
<div class="form-group">
<span>名称: </span>
<input name="name" class="form-control w70" type="number" placeholder="请输入名称">
</div>
<button id="ok" type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
<!-- table内容 -->
<table id="table"></table>
</div>
</div>
</div>
</div>
<div class="footer fixed_full text-center">
<div>
<strong>Copyright</strong> 飘逸 &copy; 2019-2020
</div>
</div>
</div>
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="./node_modules/popper.js/dist/umd/popper.js"></script>
<script type="text/javascript" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="./node_modules/bootstrap-table/dist/bootstrap-table.js"></script>
<script type="text/javascript" src="./node_modules/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script>
<!-- 自定义js内容 -->
<script type="text/javascript" src="./js/bootstrap-table-custom.js"></script>
<script>
console.log($.fn.bootstrapTable.constants);
$('#table').bootstrapTable({
height: 500,
detailView: true, // 是否显示详情 +
detailViewByClick: true, // 点击行显示显示详情
detailFormatter: function detailFormatter(index, row) { // 详情显示格式化
var html = [];
$.each(row, function (key, value) {
html.push('<p><b>' + key + ':</b> ' + value + '</p>')
});
return html.join('')
},
detailFilter: function detailFilter(index, row) { // 是否显示详情过滤
return index % 2 === 0
},
toolbar: '.toolbar',
toolbarAlign: 'left',
// buttonsToolbar: '.buttons-toolbar',
buttonsAlign: 'right',
buttonsPrefix: 'btn btn-sm ',
buttonsClass: ' text-primary ',
iconSize: 'sm',
icons: {
paginationSwitchDown: 'fa-caret-square-down',
paginationSwitchUp: 'fa-caret-square-up',
refresh: 'fa-refresh',
toggleOff: 'fa-toggle-off',
toggleOn: 'fa-toggle-on',
columns: 'fa-th-list',
detailOpen: 'fa-plus',
detailClose: 'fa-minus',
fullscreen: 'fa-arrows-alt',
search: 'fa-search',
clearSearch: 'fa-trash'
},
columns: [{
field: 'id',
title: 'Item ID'
}, {
field: 'name',
escape: true,
title: 'Item Name'
}, {
field: 'price',
title: 'Item Price'
}],
data: [
{
"id": 1,
"name": "Item 1",
"price": "$1"
},
{
"id": 2,
"name": "Item 2 <span>span 标签内容</span>",
"price": "$2"
},
{
"id": 3,
"name": "Item 3",
"price": "$3"
}
]
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/piaoyi95/bootstrap-table-example-study.git
git@gitee.com:piaoyi95/bootstrap-table-example-study.git
piaoyi95
bootstrap-table-example-study
bootstrap-table-example-study
master

搜索帮助