Permalink
Browse files

fix: 优化部分性能

  • Loading branch information...
liuyk
liuyk committed Dec 28, 2016
1 parent e54a528 commit d6feb2416c1033c113ec0196fef011727f0b71fa
Showing with 27 additions and 6 deletions.
  1. +9 −0 js/gridCompCreateCal.js
  2. +7 −5 js/re_gridCompColMenu.js
  3. +11 −1 js/re_gridCompSumRow.js
View
@@ -68,6 +68,15 @@ const countRowHeight = function(){
* 根据内容区的高度调整左侧区域的高度
*/
const resetLeftHeight = function(){
var self = this;
if(this.resetLeftHeightSetTimeout)
clearTimeout(this.resetLeftHeightSetTimeout)
this.resetLeftHeightSetTimeout = setTimeout(function(){
resetLeftHeightFun.call(self);
},100)
}
const resetLeftHeightFun = function(){
if(this.options.showNumCol || this.options.multiSelect){
var $trs = $('#' + this.options.id + '_content_tbody tr');
var $leftNums = $('#' + this.options.id + '_content_numCol div');
View
@@ -168,11 +168,12 @@ const colMenu_initGridEventFun = function(){
if(document.documentMode == 8){
var oldScrollTop = $('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop;
var oldTop = $('#' + oThis.options.id + '_column_menu_columns')[0].style.top;
var oldTop = $('#' + oThis.options.id + '_column_menu')[0].style.top;
var oldLeft = $('#' + oThis.options.id + '_column_menu')[0].style.left;
oThis.gridCompColumnArr[index].options.visible = false;
oThis.repaintGridDivs();
$('#' + oThis.options.id + '_column_menu').css('display','block');
$('#' + oThis.options.id + '_column_menu').css('right','0px');
$('#' + oThis.options.id + '_column_menu').css('left',oldLeft);
$('#' + oThis.options.id + '_column_menu').css('top',oldTop);
$('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop = oldScrollTop;
@@ -184,12 +185,13 @@ const colMenu_initGridEventFun = function(){
$(this)[0].checked = true;
if(document.documentMode == 8){
var oldScrollTop = $('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop;
var oldTop = $('#' + oThis.options.id + '_column_menu_columns')[0].style.top;
var oldScrollTop = $('#' + oThis.options.id + '_column_menu')[0].scrollTop;
var oldTop = $('#' + oThis.options.id + '_column_menu')[0].style.top;
var oldLeft = $('#' + oThis.options.id + '_column_menu')[0].style.left;
oThis.gridCompColumnArr[index].options.visible = true;
oThis.repaintGridDivs();
$('#' + oThis.options.id + '_column_menu').css('display','block');
$('#' + oThis.options.id + '_column_menu').css('right','0px');
$('#' + oThis.options.id + '_column_menu').css('left',oldLeft);
$('#' + oThis.options.id + '_column_menu').css('top',oldTop);
$('#' + oThis.options.id + '_column_menu_columns')[0].scrollTop = oldScrollTop;
}else{
View
@@ -111,6 +111,16 @@ const createSumRowForIE = function(table,createFlag){
* 重画合计行
*/
const re_repairSumRow = function(){
var self = this;
if(this.re_repairSumRowSetTimeout)
clearTimeout(this.re_repairSumRowSetTimeout)
this.re_repairSumRowSetTimeout = setTimeout(function(){
re_repairSumRowFun.call(self);
},100)
};
const re_repairSumRowFun = function(){
if(this.options.showSumRow){
$('#' + this.options.id + '_content_div tbody .u-grid-content-sum-row').remove();
$('#' + this.options.id + '_content_fixed_div tbody .u-grid-content-sum-row').remove();
@@ -130,7 +140,7 @@ const re_repairSumRow = function(){
}
this.renderSumRow();
}
};
}
const renderSumRow = function(){
var oThis = this;

0 comments on commit d6feb24

Please sign in to comment.