修复 table 当点击筛选显示隐藏固定列时出现的未对齐的问题

pull/1307/head
贤心 2023-07-13 09:14:27 +08:00
parent 45d7db9ec1
commit 2fcef5ae8b
1 changed files with 44 additions and 44 deletions

View File

@ -555,15 +555,15 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 初始工具栏 // 初始工具栏
Class.prototype.renderToolbar = function(){ Class.prototype.renderToolbar = function(){
var that = this var that = this
,options = that.config var options = that.config
// 添加工具栏左侧模板 // 添加工具栏左侧模板
var leftDefaultTemp = [ var leftDefaultTemp = [
'<div class="layui-inline" lay-event="add"><i class="layui-icon layui-icon-add-1"></i></div>' '<div class="layui-inline" lay-event="add"><i class="layui-icon layui-icon-add-1"></i></div>',
,'<div class="layui-inline" lay-event="update"><i class="layui-icon layui-icon-edit"></i></div>' '<div class="layui-inline" lay-event="update"><i class="layui-icon layui-icon-edit"></i></div>',
,'<div class="layui-inline" lay-event="delete"><i class="layui-icon layui-icon-delete"></i></div>' '<div class="layui-inline" lay-event="delete"><i class="layui-icon layui-icon-delete"></i></div>'
].join('') ].join('');
,elemToolTemp = that.layTool.find('.layui-table-tool-temp'); var elemToolTemp = that.layTool.find('.layui-table-tool-temp');
if(options.toolbar === 'default'){ if(options.toolbar === 'default'){
elemToolTemp.html(leftDefaultTemp); elemToolTemp.html(leftDefaultTemp);
@ -577,19 +577,19 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 添加工具栏右侧面板 // 添加工具栏右侧面板
var layout = { var layout = {
filter: { filter: {
title: '筛选列' title: '筛选列',
,layEvent: 'LAYTABLE_COLS' layEvent: 'LAYTABLE_COLS',
,icon: 'layui-icon-cols' icon: 'layui-icon-cols'
} },
,exports: { exports: {
title: '导出' title: '导出',
,layEvent: 'LAYTABLE_EXPORT' layEvent: 'LAYTABLE_EXPORT',
,icon: 'layui-icon-export' icon: 'layui-icon-export'
} },
,print: { print: {
title: '打印' title: '打印',
,layEvent: 'LAYTABLE_PRINT' layEvent: 'LAYTABLE_PRINT',
,icon: 'layui-icon-print' icon: 'layui-icon-print'
} }
}, iconElem = []; }, iconElem = [];
@ -608,10 +608,10 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 分页栏 // 分页栏
Class.prototype.renderPagebar = function(){ Class.prototype.renderPagebar = function(){
var that = this var that = this;
,options = that.config var options = that.config;
,layPagebar = that.layPagebar = $('<div class="layui-inline layui-table-pagebar"></div>') var layPagebar = that.layPagebar = $('<div class="layui-inline layui-table-pagebar"></div>');
// 开启分页栏自定义模板 // 开启分页栏自定义模板
if(options.pagebar){ if(options.pagebar){
@ -623,15 +623,15 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 同步表头父列的相关值 // 同步表头父列的相关值
Class.prototype.setParentCol = function(hide, parentKey){ Class.prototype.setParentCol = function(hide, parentKey){
var that = this var that = this;
,options = that.config var options = that.config;
,parentTh = that.layHeader.find('th[data-key="'+ parentKey +'"]') //获取父列元素 var parentTh = that.layHeader.find('th[data-key="'+ parentKey +'"]'); // 获取父列元素
,parentColspan = parseInt(parentTh.attr('colspan')) || 0; var parentColspan = parseInt(parentTh.attr('colspan')) || 0;
if(parentTh[0]){ if(parentTh[0]){
var arrParentKey = parentKey.split('-') var arrParentKey = parentKey.split('-');
,getThisCol = options.cols[arrParentKey[1]][arrParentKey[2]]; var getThisCol = options.cols[arrParentKey[1]][arrParentKey[2]];
hide ? parentColspan-- : parentColspan++; hide ? parentColspan-- : parentColspan++;
@ -1784,7 +1784,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
that.layFixed.find(ELEM_BODY).css( that.layFixed.find(ELEM_BODY).css(
'height', 'height',
layMainTable.height() >= fixHeight ? fixHeight : 'auto' layMainTable.height() >= fixHeight ? fixHeight : 'auto'
); ).scrollTop(that.layMain.scrollTop()); // 固定列滚动条高度
// 表格宽度小于容器宽度时,隐藏固定列 // 表格宽度小于容器宽度时,隐藏固定列
that.layFixRight[ that.layFixRight[
@ -2484,9 +2484,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 同步滚动条 // 同步滚动条
that.layMain.on('scroll', function(){ that.layMain.on('scroll', function(){
var othis = $(this) var othis = $(this);
,scrollLeft = othis.scrollLeft() var scrollLeft = othis.scrollLeft();
,scrollTop = othis.scrollTop(); var scrollTop = othis.scrollTop();
that.layHeader.scrollLeft(scrollLeft); that.layHeader.scrollLeft(scrollLeft);
that.layTotal.scrollLeft(scrollLeft); that.layTotal.scrollLeft(scrollLeft);
@ -2495,7 +2495,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
layer.close(that.tipsIndex); layer.close(that.tipsIndex);
}); });
//适应 // 适应
_WIN.on('resize', function(){ _WIN.on('resize', function(){
that.resize(); that.resize();
}); });