diff --git a/src/css/layui.css b/src/css/layui.css index 16f53ce1..eb199515 100644 --- a/src/css/layui.css +++ b/src/css/layui.css @@ -989,13 +989,16 @@ a cite{font-style: normal; *cursor:pointer;} .layui-table-page .layui-laypage input{width: 40px;} .layui-table-page .layui-laypage button{padding: 0 10px;} .layui-table-page select{height: 18px;} -.layui-table-pagebar{float: right; line-height: 32px;} +.layui-table-pagebar{float: right; line-height: 23px;} +.layui-table-pagebar .layui-btn-sm{margin-top: -2px;} +.layui-table-pagebar .layui-btn-xs{margin-top: 2px;} .layui-table-view select[lay-ignore]{display: inline-block;} .layui-table-patch .layui-table-cell{padding: 0; width: 30px;} .layui-table-edit{position: absolute; left: 0; top: 0; z-index: 900; min-width: 100%; min-height: 100%; padding: 5px 14px; border-radius: 0; box-shadow: 1px 1px 20px rgba(0,0,0,.15); background-color: #fff;} .layui-table-edit:focus{border-color: #5FB878!important;} +input.layui-input.layui-table-edit{height: 100%;} select.layui-table-edit{padding: 0 0 0 10px; border-color: #d2d2d2;} .layui-table-view .layui-form-switch, .layui-table-view .layui-form-checkbox, diff --git a/src/modules/table.js b/src/modules/table.js index c0d1af9a..90a1b0ea 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -197,7 +197,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ ,'{{# }; }}' ,'{{# if(right){ }}' - ,'
' + ,'
' ,'
' ,TPL_HEADER({fixed: 'right'}) ,'
' @@ -380,7 +380,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ if(options.cols.length > 1){ // 补全高度 var th = that.layFixed.find(ELEM_HEADER).find('th'); - th.height(that.layHeader.height() - 1 - parseFloat(th.css('padding-top')) - parseFloat(th.css('padding-bottom'))); + // 固定列表头同步跟本体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'); + }) } that.pullData(that.page); //请求数据 @@ -867,6 +872,10 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ //渲染视图 ,render = function(){ //后续性能提升的重点 + //同步表头父列的相关值 + options.HAS_SET_COLS_PATCH || that.setColsPatch(); + options.HAS_SET_COLS_PATCH = true; + var thisCheckedRowIndex; if(!sort && that.sortKey){ return that.sort(that.sortKey.field, that.sortKey.sort, true); @@ -1013,10 +1022,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ that.haveInit = true; layer.close(that.tipsIndex); - - //同步表头父列的相关值 - options.HAS_SET_COLS_PATCH || that.setColsPatch(); - options.HAS_SET_COLS_PATCH = true; }; table.cache[that.key] = data; //记录数据 @@ -1040,7 +1045,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ that.renderForm(); return that.errorView(options.text.none); } else { - that.layFixed.removeClass(HIDE); + that.layFixLeft.removeClass(HIDE); } //如果执行初始排序 @@ -2116,12 +2121,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ var nums = 0 ,invalidNum = 0 ,arr = [] + ,arrDisabled = [] ,data = table.cache[id] || []; //计算全选个数 layui.each(data, function(i, item){ - if(layui.type(item) === 'array' || item[table.config.disabledName]){ // 不可操作的节点对于统计来说也属于无效 + if(layui.type(item) === 'array'){ invalidNum++; //无效数据,或已删除的 + return; + } + if (item[table.config.disabledName]) { + invalidNum++; //不可操作的数据也不计入内 + arrDisabled.push(table.clearCacheKey(item)); } if(item[table.config.checkName]){ arr.push(table.clearCacheKey(item)); @@ -2133,6 +2144,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ return { data: arr //选中的数据 ,isAll: data.length ? (nums === (data.length - invalidNum)) : false //是否全选 + ,dataDisabled: arrDisabled //不可操作的记录(选中与否的都在内) }; };