默认配置表格支持移动端适配

master
gcii 6 years ago
parent 38f2e1593e
commit 4917c819a0

@ -167,6 +167,15 @@ public class DemoTableController extends BaseController
return prefix + "/detail";
}
/**
*
*/
@GetMapping("/child")
public String child()
{
return prefix + "/child";
}
/**
*
*/

@ -832,6 +832,10 @@ label {
display: inline-block
}
.editable-input .input-sm {
height: 32px!important;
}
/** 表格冻结列样式 **/
.left-fixed-table-columns, .left-fixed-body-columns {
position: absolute;

@ -35,6 +35,7 @@
showToggle: true,
showExport: false,
clickToSelect: false,
mobileResponsive: true,
rememberSelected: false,
fixedColumns: false,
fixedNumber: 0,
@ -78,6 +79,7 @@
showExport: options.showExport, // 是否支持导出文件
uniqueId: options.uniqueId, // 唯 一的标识符
clickToSelect: options.clickToSelect, // 是否启用点击选中行
mobileResponsive: options.mobileResponsive, // 是否支持移动端适配
detailView: options.detailView, // 是否启用显示细节视图
onClickRow: options.onClickRow, // 点击某行触发的事件
onDblClickRow: options.onDblClickRow, // 双击某行触发的事件

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -30,7 +30,7 @@
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -23,7 +23,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('表格父子视图')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var prefix = ctx + "demo/table";
var datas = [[${@dict.getType('sys_normal_disable')}]];
$(function() {
var options = {
url: prefix + "/list",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
detailView: true,
onExpandRow : function(index, row, $detail) {
initChildTable(index, row, $detail);
},
columns: [{
checkbox: true
},
{
field : 'userId',
title : '用户ID'
},
{
field : 'userCode',
title : '用户编号'
},
{
field : 'userName',
title : '用户姓名'
},
{
field : 'userPhone',
title : '用户手机'
},
{
field : 'userEmail',
title : '用户邮箱'
},
{
field : 'userBalance',
title : '用户余额'
},
{
field: 'status',
title: '用户状态',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(datas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
initChildTable = function(index, row, $detail) {
var cur_table = $detail.html('<table style="table-layout:fixed"></table>').find('table');
$(cur_table).bootstrapTable({
url: prefix + "/list",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded", // 编码类型
queryParams : {
userName: '测试8'
},
columns: [{
field : 'userId',
title : '子表ID'
},
{
field : 'userCode',
title : '子表编号'
},
{
field : 'userName',
title : '子表姓名'
},
{
field: 'status',
title: '子表状态',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(datas, value);
}
}]
});
};
</script>
</body>
</html>

@ -36,7 +36,7 @@
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -16,7 +16,7 @@
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -8,7 +8,7 @@
<div class="row">
<div class="col-sm-12 select-table table-striped">
<p class="select-title">自定义触发事件(点击某行/双击某行/单击某格/双击某格/服务器发送数据前触发/数据被加载时触发)</p>
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -18,7 +18,7 @@
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-bordered">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -33,7 +33,7 @@
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table1" data-mobile-responsive="true"></table>
<table id="bootstrap-table1"></table>
</div>
</div>
</div>
@ -68,7 +68,7 @@
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table2" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -27,7 +27,7 @@
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table1"></table>
</div>
</div>
</div>

@ -7,7 +7,7 @@
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table1"></table>
</div>
</div>
</div>

@ -8,7 +8,7 @@
<div class="row">
<div class="col-sm-12 select-table table-striped">
<p class="select-title">通过queryParams方法设置</p>
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table1"></table>
</div>
<div class="col-sm-12 search-collapse">
@ -24,7 +24,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<p class="select-title">通过form自动填充</p>
<table id="bootstrap-table-form" data-mobile-responsive="true"></table>
<table id="bootstrap-table1"></table>
</div>
</div>
</div>

@ -12,7 +12,7 @@
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table1"></table>
</div>
</div>
</div>

@ -8,7 +8,7 @@
<div class="row">
<div class="col-sm-12 select-table table-striped">
<p class="select-title">按住表格拖拽</p>
<table id="bootstrap-table" data-mobile-responsive="true"
<table id="bootstrap-table"
data-use-row-attr-func="true"
data-reorderable-rows="true"></table>
</div>

@ -103,6 +103,7 @@
<li><a class="menuItem" th:href="@{/demo/table/fixedColumns}">表格冻结列</a></li>
<li><a class="menuItem" th:href="@{/demo/table/event}">自定义触发事件</a></li>
<li><a class="menuItem" th:href="@{/demo/table/detail}">表格细节视图</a></li>
<li><a class="menuItem" th:href="@{/demo/table/child}">表格父子视图</a></li>
<li><a class="menuItem" th:href="@{/demo/table/image}">表格图片预览</a></li>
<li><a class="menuItem" th:href="@{/demo/table/curd}">动态增删改查</a></li>
<li><a class="menuItem" th:href="@{/demo/table/reorder}">表格拖拽操作</a></li>

@ -50,7 +50,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -32,7 +32,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -56,7 +56,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -52,7 +52,7 @@
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -49,7 +49,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -53,7 +53,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -44,7 +44,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -47,7 +47,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -39,7 +39,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -53,7 +53,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -28,7 +28,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -80,7 +80,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -47,7 +47,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -26,7 +26,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -74,7 +74,7 @@
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -17,3 +17,6 @@ values('${functionName}修改', @parentId, '3', '#', 'F', '0', '${permissionPr
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}删除', @parentId, '4', '#', 'F', '0', '${permissionPrefix}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}导出', @parentId, '5', '#', 'F', '0', '${permissionPrefix}:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');

@ -53,7 +53,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

@ -54,7 +54,7 @@
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>

Loading…
Cancel
Save