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

pull/1307/head
贤心 1 year ago
parent 45d7db9ec1
commit 2fcef5ae8b

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

Loading…
Cancel
Save