优化 table 局部代码书写规范
This commit is contained in:
parent
8bd84158f5
commit
689866c483
@ -1111,7 +1111,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
curr = curr || 1
|
curr = curr || 1
|
||||||
|
|
||||||
layui.each(data, function(i1, item1){
|
layui.each(data, function(i1, item1){
|
||||||
var tds = [];
|
var tds = [];
|
||||||
var tds_fixed = [];
|
var tds_fixed = [];
|
||||||
var tds_fixed_r = [];
|
var tds_fixed_r = [];
|
||||||
var numbers = i1 + options.limit*(curr - 1) + 1; // 序号
|
var numbers = i1 + options.limit*(curr - 1) + 1; // 序号
|
||||||
@ -1208,7 +1208,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
case 'numbers':
|
case 'numbers':
|
||||||
return numbers;
|
return numbers;
|
||||||
//break;
|
//break;
|
||||||
};
|
}
|
||||||
|
|
||||||
//解析工具列模板
|
//解析工具列模板
|
||||||
if(item3.toolbar){
|
if(item3.toolbar){
|
||||||
@ -1771,7 +1771,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
|
|
||||||
//获取滚动条宽度
|
//获取滚动条宽度
|
||||||
Class.prototype.getScrollWidth = function(elem){
|
Class.prototype.getScrollWidth = function(elem){
|
||||||
var width = 0;
|
var width;
|
||||||
if(elem){
|
if(elem){
|
||||||
width = elem.offsetWidth - elem.clientWidth;
|
width = elem.offsetWidth - elem.clientWidth;
|
||||||
} else {
|
} else {
|
||||||
@ -1791,19 +1791,19 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
Class.prototype.scrollPatch = function(){
|
Class.prototype.scrollPatch = function(){
|
||||||
var that = this;
|
var that = this;
|
||||||
var layMainTable = that.layMain.children('table');
|
var layMainTable = that.layMain.children('table');
|
||||||
var scollWidth = that.layMain.width() - that.layMain.prop('clientWidth'); // 纵向滚动条宽度
|
var scrollWidth = that.layMain.width() - that.layMain.prop('clientWidth'); // 纵向滚动条宽度
|
||||||
var scollHeight = that.layMain.height() - that.layMain.prop('clientHeight'); // 横向滚动条高度
|
var scrollHeight = that.layMain.height() - that.layMain.prop('clientHeight'); // 横向滚动条高度
|
||||||
var getScrollWidth = that.getScrollWidth(that.layMain[0]); // 获取主容器滚动条宽度,如果有的话
|
var getScrollWidth = that.getScrollWidth(that.layMain[0]); // 获取主容器滚动条宽度,如果有的话
|
||||||
var outWidth = layMainTable.outerWidth() - that.layMain.width(); // 表格内容器的超出宽度
|
var outWidth = layMainTable.outerWidth() - that.layMain.width(); // 表格内容器的超出宽度
|
||||||
|
|
||||||
// 添加补丁
|
// 添加补丁
|
||||||
var addPatch = function(elem){
|
var addPatch = function(elem){
|
||||||
if(scollWidth && scollHeight){
|
if(scrollWidth && scrollHeight){
|
||||||
elem = elem.eq(0);
|
elem = elem.eq(0);
|
||||||
if(!elem.find('.layui-table-patch')[0]){
|
if(!elem.find('.layui-table-patch')[0]){
|
||||||
var patchElem = $('<th class="layui-table-patch"><div class="layui-table-cell"></div></th>'); // 补丁元素
|
var patchElem = $('<th class="layui-table-patch"><div class="layui-table-cell"></div></th>'); // 补丁元素
|
||||||
patchElem.find('div').css({
|
patchElem.find('div').css({
|
||||||
width: scollWidth
|
width: scrollWidth
|
||||||
});
|
});
|
||||||
elem.find('tr').append(patchElem);
|
elem.find('tr').append(patchElem);
|
||||||
}
|
}
|
||||||
@ -1817,7 +1817,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
|
|
||||||
// 固定列区域高度
|
// 固定列区域高度
|
||||||
var mainHeight = that.layMain.height();
|
var mainHeight = that.layMain.height();
|
||||||
var fixHeight = mainHeight - scollHeight;
|
var fixHeight = mainHeight - scrollHeight;
|
||||||
|
|
||||||
that.layFixed.find(ELEM_BODY).css(
|
that.layFixed.find(ELEM_BODY).css(
|
||||||
'height',
|
'height',
|
||||||
@ -1832,7 +1832,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
](HIDE);
|
](HIDE);
|
||||||
|
|
||||||
// 操作栏
|
// 操作栏
|
||||||
that.layFixRight.css('right', scollWidth - 1);
|
that.layFixRight.css('right', scrollWidth - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 事件处理
|
// 事件处理
|
||||||
@ -1972,7 +1972,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
|
|
||||||
printWin.document.write(style + html.prop('outerHTML'));
|
printWin.document.write(style + html.prop('outerHTML'));
|
||||||
printWin.document.close();
|
printWin.document.close();
|
||||||
|
|
||||||
if(layui.device('edg').edg){
|
if(layui.device('edg').edg){
|
||||||
printWin.onafterprint = printWin.close;
|
printWin.onafterprint = printWin.close;
|
||||||
printWin.print();
|
printWin.print();
|
||||||
@ -2319,7 +2319,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
|||||||
].join(',');
|
].join(',');
|
||||||
if( $(e.target).is(UNROW) || $(e.target).closest(UNROW)[0]){
|
if( $(e.target).is(UNROW) || $(e.target).closest(UNROW)[0]){
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
setRowEvent.call(this, 'row');
|
setRowEvent.call(this, 'row');
|
||||||
}).on('dblclick', 'tr', function(){ // 双击行
|
}).on('dblclick', 'tr', function(){ // 双击行
|
||||||
setRowEvent.call(this, 'rowDouble');
|
setRowEvent.call(this, 'rowDouble');
|
||||||
|
Loading…
Reference in New Issue
Block a user