Merge pull request #1072 from layui/2.x

2.x to main
pull/1075/head
贤心 2022-07-06 09:34:35 +08:00 committed by GitHub
commit d976d61b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View File

@ -171,7 +171,7 @@ layui.use(['table', 'dropdown'], function(){
]]
//,autoSort: false // 禁用前端自动排序,由服务的完成排序
,initSort11111: { // 初始排序状态
,initSort111: { // 初始排序状态
field: 'experience' //排序字段,对应 cols 设定的各字段名
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序
}
@ -263,7 +263,7 @@ layui.use(['table', 'dropdown'], function(){
//,url: '404'
//,elem: null
//,page: {curr: 5, limit: 20}
//,scrollPos: 'fixed' // 保持滚动条位置不变
,scrollPos: 'fixed' // 保持滚动条位置不变
});
break;
case 'reloadData-deep':

View File

@ -61,7 +61,7 @@
<table id="test2" lay-filter="test2"></table>
<div style="display: none1;">
<table class="layui-table" lay-data="{width:800, height: 300, url:'json/table/demo2.json', page: true, limit: 6}">
<table class="layui-table" lay-data="{width:800, height: 300, url:'json/table/demo2.json', page: true, limit: 6, toolbar: true}">
<thead>
<tr>
<th lay-data="{checkbox:true, fixed:'left'}" rowspan="2"></th>
@ -78,7 +78,7 @@
</thead>
</table>
<table class="layui-table" lay-data="{url:'json/table/demo2.json', page: true, limit: 6}">
<table class="layui-table" lay-data="{url:'json/table/demo2.json', page: true, limit: 6, toolbar: true}">
<thead>
<tr>
<th lay-data="{field:'username'}" rowspan="3">联系人</th>

View File

@ -816,7 +816,7 @@
});
return that;
}
};
//无效日期范围的标记
Class.prototype.limit = function(elem, date, index, time){

View File

@ -124,6 +124,7 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
,ELEM_SORT = '.layui-table-sort'
,ELEM_EDIT = 'layui-table-edit'
,ELEM_HOVER = 'layui-table-hover'
,ELEM_COL_SPECIAL = 'layui-table-col-special'
,DATA_MOVE_NAME = 'LAY_TABLE_MOVE_DICT'
@ -976,7 +977,7 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
}() +' class="'+ function(){ //追加样式
var classNames = [];
if(item3.hide) classNames.push(HIDE); //插入隐藏列样式
if(!item3.field) classNames.push('layui-table-col-special'); //插入特殊列样式
if(!item3.field) classNames.push(ELEM_COL_SPECIAL); //插入特殊列样式
return classNames.join(' ');
}() +'">'
,'<div class="layui-table-cell laytable-cell-'+ function(){ //返回对应的CSS类标识
@ -1201,7 +1202,7 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
}() +' class="'+ function(){ //追加样式
var classNames = [];
if(item3.hide) classNames.push(HIDE); //插入隐藏列样式
if(!item3.field) classNames.push('layui-table-col-special'); //插入特殊列样式
if(!item3.field) classNames.push(ELEM_COL_SPECIAL); //插入特殊列样式
return classNames.join(' ');
}() +'">'
,'<div class="layui-table-cell laytable-cell-'+ function(){ //返回对应的CSS类标识
@ -1315,6 +1316,7 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
} else { //清除排序
thisData = layui.sort(data, table.config.indexName);
delete that.sortKey;
delete options.initSort;
}
}
@ -1624,13 +1626,11 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
html.append(that.layTotal.find('table').html()) //输出合计行
html.find('th.layui-table-patch').remove(); //移除补丁
layui.each(html.find('thead>tr>th.layui-table-col-special'), function (thIndex, thElem) {
thElem = $(thElem);
if (!thElem.children('.laytable-cell-group').length) { // 表头特殊列中和并列不移除
thElem.remove();
}
})
html.find('tbody>tr>td.layui-table-col-special').remove(); // 移除表体特殊列
// 移除表头特殊列
html.find('thead>tr>th.'+ ELEM_COL_SPECIAL).filter(function(i, thElem){
return !$(thElem).children('.laytable-cell-group').length; // 父级表头除外
}).remove();
html.find('tbody>tr>td.'+ ELEM_COL_SPECIAL).remove(); // 移除表体特殊列
printWin.document.write(style + html.prop('outerHTML'));
printWin.document.close();