add table onColumnsWidth 修改宽度之后回调返回cols
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
@@ -65,8 +65,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
that.resize.call(that);
|
||||
},
|
||||
getData: function(){
|
||||
console.log(that)
|
||||
return that.config.data
|
||||
},
|
||||
// 设置列宽调整后的回调
|
||||
onColumnsWidth: function(fun){
|
||||
that.config.onColumnsWidth = fun;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1291,7 +1294,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//同步选中值状态
|
||||
Class.prototype.setCheckData = function(index, checked){
|
||||
console.log("同步选中值状态",index,checked,this)
|
||||
var that = this
|
||||
,options = that.config
|
||||
,thisData = table.cache[that.key];
|
||||
@@ -1376,16 +1378,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
bodyHeight -= (that.layPage.outerHeight() || 41);
|
||||
}
|
||||
// 减去筛选插件高度
|
||||
// console.log(this.layBorderBox.find(".soul-bottom-contion"))
|
||||
if(this.layBorderBox.find(".soul-bottom-contion")[0]){
|
||||
bodyHeight -= (this.layBorderBox.find(".soul-bottom-contion")[0].offsetHeight || 31);
|
||||
}
|
||||
console.log(bodyHeight,"bodyHeight")
|
||||
let h = bodyHeight - 2 - parseFloat(that.layMain.css('height'));
|
||||
// console.log(h)
|
||||
// that.layBody.css("height", parseFloat(that.layBody.css("height")) + h);
|
||||
// that.layBorderBox.css("height", parseFloat(that.layBorderBox.css("height")) + h);
|
||||
console.log(this.config)
|
||||
|
||||
that.layMain.css('height', bodyHeight - 2);
|
||||
};
|
||||
@@ -1616,12 +1614,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
e.preventDefault();
|
||||
dict.resizeStart = true; //开始拖拽
|
||||
dict.offset = [e.clientX, e.clientY]; //记录初始坐标
|
||||
|
||||
that.getCssRule(key, function(item){
|
||||
var width = item.style.width || othis.outerWidth();
|
||||
dict.rule = item;
|
||||
dict.ruleWidth = parseFloat(width);
|
||||
dict.minWidth = othis.data('minwidth') || options.cellMinWidth;
|
||||
dict.target = othis[0]
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1640,6 +1638,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
}
|
||||
}).on('mouseup', function(e){
|
||||
if(dict.resizeStart){
|
||||
// 处理宽度
|
||||
for(let j of that.config.cols){
|
||||
for(let i of j){
|
||||
if(i.field == dict.target.dataset.field){
|
||||
i.width = dict.target.clientWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
that.config.onColumnsWidth && that.config.onColumnsWidth(that.config.cols)
|
||||
dict = {};
|
||||
_BODY.css('cursor', '');
|
||||
that.scrollPatch();
|
||||
|
||||
Reference in New Issue
Block a user