优化 table 列宽自适应
This commit is contained in:
@@ -101,7 +101,7 @@ body{padding: 20px; /*overflow-y: scroll;*/}
|
||||
<th lay-data="{checkbox:true}"></th>
|
||||
<th lay-data="{field:'username', width:200}">昵称</th>
|
||||
<th lay-data="{field:'joinTime', width:150}">加入时间</th>
|
||||
<th lay-data="{field:'sign', width:300}">签名</th>
|
||||
<th lay-data="{field:'sign'}">签名</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -129,7 +129,7 @@ body{padding: 20px; /*overflow-y: scroll;*/}
|
||||
<table class="layui-table" lay-filter="parse-table-demo">
|
||||
<thead>
|
||||
<tr>
|
||||
<td rowspan="2" lay-data="{field:'louceng', width:200}">楼层</td>
|
||||
<td rowspan="2" lay-data="{field:'louceng'}">楼层</td>
|
||||
<td colspan="2">1单元</td>
|
||||
<td colspan="2">2单元</td>
|
||||
</tr>
|
||||
@@ -198,7 +198,6 @@ layui.use('table', function(){
|
||||
,{field:'logins', title:'登入次数', width:100, sort: true}
|
||||
,{field:'joinTime', title:'加入时间', width:120}
|
||||
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
|
||||
,
|
||||
]]
|
||||
});
|
||||
|
||||
@@ -212,7 +211,7 @@ layui.use('table', function(){
|
||||
,last: false
|
||||
,layout: ['limit', 'prev', 'page', 'next', 'count'] //自定义分页布局
|
||||
}
|
||||
//,height: 300
|
||||
,height: 300
|
||||
,cellMinWidth: 80
|
||||
,cols: [[
|
||||
{type:'numbers'}
|
||||
@@ -223,7 +222,6 @@ layui.use('table', function(){
|
||||
,{field:'sex', title:'性别', templet: '#switchTpl', minWidth: 85, align:'center'}
|
||||
,{field:'lock', title:'是否锁定', templet: '#checkboxTpl', minWidth: 110, align:'center'}
|
||||
,{field:'city', title:'城市'}
|
||||
,
|
||||
]]
|
||||
});
|
||||
|
||||
@@ -280,6 +278,19 @@ layui.use('table', function(){
|
||||
//直接赋值数据
|
||||
table.render({
|
||||
elem: '#demo'
|
||||
//,width: 900
|
||||
//,height: 274
|
||||
,cols: [[ //标题栏
|
||||
{type: 'checkbox', LAY_CHECKED: true}
|
||||
,{field: 'id', title: 'ID', width: 80, sort: true}
|
||||
,{type: 'space', width: 100} //空列
|
||||
,{field: 'username', title: '用户名', width: 120}
|
||||
,{field: 'email', title: '邮箱', width: 150}
|
||||
,{field: 'sign', title: '签名', width: 150}
|
||||
,{field: 'sex', title: '性别', width: 80}
|
||||
,{field: 'city', title: '城市', width: 100}
|
||||
,{field: 'experience', title: '积分', width: 80, sort: true}
|
||||
]]
|
||||
,data: [{
|
||||
"id": "10001"
|
||||
,"username": "杜甫"
|
||||
@@ -370,21 +381,7 @@ layui.use('table', function(){
|
||||
,"logins": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
}]
|
||||
,width: 900
|
||||
//,height: 274
|
||||
,cols: [[ //标题栏
|
||||
{type: 'checkbox', LAY_CHECKED: true}
|
||||
,{field: 'id', title: 'ID', width: 80, sort: true}
|
||||
,{type: 'space', width: 100} //空列
|
||||
,{field: 'username', title: '用户名', width: 120}
|
||||
,{field: 'email', title: '邮箱', width: 150}
|
||||
,{field: 'sign', title: '签名', width: 150}
|
||||
,{field: 'sex', title: '性别', width: 80}
|
||||
,{field: 'city', title: '城市', width: 100}
|
||||
,{field: 'experience', title: '积分', width: 80, sort: true}
|
||||
]]
|
||||
|
||||
,id:'test111'
|
||||
|
||||
,skin: 'row' //表格风格
|
||||
,even: true
|
||||
//,size: 'lg' //尺寸
|
||||
@@ -412,7 +409,9 @@ layui.use('table', function(){
|
||||
layer.msg(checkStatus.isAll ? '全选': '未全选')
|
||||
}
|
||||
,parseTable: function(){
|
||||
table.init('parse-table-demo',{limit: 1});
|
||||
table.init('parse-table-demo', {
|
||||
limit: 3
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user