代码拉取完成,页面将自动刷新
<!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> 飘逸 © 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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。