mirror of https://github.com/layui/layui
修复table有固定列的复杂表头,筛选列之后出现的固定列高度跟本体不一致的问题;table字段配置新增fieldTitle属性用于筛选列和导出的时候自定义表头信息。
parent
af0b38385c
commit
751c5cbe7b
|
@ -629,10 +629,10 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
hide ? parentColspan-- : parentColspan++;
|
hide ? parentColspan-- : parentColspan++;
|
||||||
|
|
||||||
parentTh.attr('colspan', parentColspan);
|
parentTh.attr('colspan', parentColspan);
|
||||||
parentTh[parentColspan < 1 ? 'addClass' : 'removeClass'](HIDE);
|
parentTh[parentColspan >= 1 || !hide ? 'removeClass' : 'addClass'](HIDE); // 如果子列显示,父列必然需要显示
|
||||||
|
|
||||||
getThisCol.colspan = parentColspan; //同步 colspan 参数
|
getThisCol.colspan = parentColspan; //同步 colspan 参数
|
||||||
getThisCol.hide = parentColspan < 1; //同步 hide 参数
|
getThisCol.hide = parentColspan >= 1 || !hide; //同步 hide 参数
|
||||||
|
|
||||||
//递归,继续往上查询是否有父列
|
//递归,继续往上查询是否有父列
|
||||||
var nextParentKey = parentTh.data('parentkey');
|
var nextParentKey = parentTh.data('parentkey');
|
||||||
|
@ -1551,6 +1551,19 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
that.elem.css("height", height);
|
that.elem.css("height", height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debugger;
|
||||||
|
// 如果多级表头,则填补表头高度
|
||||||
|
if(options.cols.length > 1){
|
||||||
|
// 补全高度
|
||||||
|
var th = that.layFixed.find(ELEM_HEADER).find('th');
|
||||||
|
// 固定列表头同步跟本体 th 一致高度
|
||||||
|
var headerMain = that.layHeader.first();
|
||||||
|
layui.each(th, function (thIndex, thElem) {
|
||||||
|
thElem = $(thElem);
|
||||||
|
thElem.height(headerMain.find('th[data-key="' + thElem.attr('data-key') + '"]').height() + 'px');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if(!height) return;
|
if(!height) return;
|
||||||
|
|
||||||
//减去列头区域的高度
|
//减去列头区域的高度
|
||||||
|
@ -1581,18 +1594,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
} else {
|
} else {
|
||||||
that.layMain.outerHeight(bodyHeight);
|
that.layMain.outerHeight(bodyHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果多级表头,则填补表头高度
|
|
||||||
if(options.cols.length > 1){
|
|
||||||
// 补全高度
|
|
||||||
var th = that.layFixed.find(ELEM_HEADER).find('th');
|
|
||||||
// 固定列表头同步跟本体 th 一致高度
|
|
||||||
var headerMain = that.layHeader.first();
|
|
||||||
layui.each(th, function (thIndex, thElem) {
|
|
||||||
thElem = $(thElem);
|
|
||||||
thElem.height(headerMain.find('th[data-key="' + thElem.attr('data-key') + '"]').height() + 'px');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//获取滚动条宽度
|
//获取滚动条宽度
|
||||||
|
@ -1725,6 +1726,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
](HIDE);
|
](HIDE);
|
||||||
|
|
||||||
// 根据列的显示隐藏,同步多级表头的父级相关属性值
|
// 根据列的显示隐藏,同步多级表头的父级相关属性值
|
||||||
|
debugger;
|
||||||
if(hide != col.hide){
|
if(hide != col.hide){
|
||||||
that.setParentCol(!checked, parentKey);
|
that.setParentCol(!checked, parentKey);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue