mirror of https://github.com/layui/layui
fix(table): 改进表格自动调整大小的处理 (#2284)
* fix(table): 修复表格列宽计算一些边缘情况 * fix(table): 改进自动调整大小的处理pull/2318/head
parent
c10837393b
commit
7869687e81
|
@ -501,7 +501,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
try {
|
try {
|
||||||
isNone = parent.css('display') === 'none';
|
isNone = parent.css('display') === 'none';
|
||||||
} catch(e){}
|
} catch(e){}
|
||||||
if(parent[0] && !lay.isTopElem(parent[0]) && (!width || isNone)) return getWidth(parent.parent());
|
var parentElem = parent.parent();
|
||||||
|
if(parent[0] && parentElem && parentElem.nodeType === 1 && (!width || isNone)) return getWidth(parentElem);
|
||||||
return width;
|
return width;
|
||||||
};
|
};
|
||||||
return getWidth();
|
return getWidth();
|
||||||
|
@ -1060,7 +1061,11 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
Class.prototype.resize = function(){
|
Class.prototype.resize = function(){
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
if (!that.layMain) return;
|
var tableElemIsConnected = that.layMain && ('isConnected' in that.layMain[0]
|
||||||
|
? that.layMain[0].isConnected
|
||||||
|
: $.contains(document.body, that.layMain[0]));
|
||||||
|
|
||||||
|
if(!tableElemIsConnected) return;
|
||||||
|
|
||||||
that.fullSize(); // 让表格铺满
|
that.fullSize(); // 让表格铺满
|
||||||
that.setColsWidth(); // 自适应列宽
|
that.setColsWidth(); // 自适应列宽
|
||||||
|
|
Loading…
Reference in New Issue