Browse Source

bugfix:没有可见的单元格可能之前就已经有渲染的了

es6
guy 3 years ago
parent
commit
7a3e66ae92
  1. 8
      src/base/grid/grid.js

8
src/base/grid/grid.js

@ -130,9 +130,9 @@ BI.GridView = BI.inherit(BI.Widget, {
var visibleColumnIndices = this._columnSizeAndPositionManager.getVisibleCellRange(width, scrollLeft); var visibleColumnIndices = this._columnSizeAndPositionManager.getVisibleCellRange(width, scrollLeft);
var visibleRowIndices = this._rowSizeAndPositionManager.getVisibleCellRange(height, scrollTop); var visibleRowIndices = this._rowSizeAndPositionManager.getVisibleCellRange(height, scrollTop);
if (BI.isEmpty(visibleColumnIndices) || BI.isEmpty(visibleRowIndices)) { var renderedCells = [], renderedKeys = {}, renderedWidgets = {};
return; // 没有可见的单元格就干掉所有渲染过的
} if (!BI.isEmpty(visibleColumnIndices) && !BI.isEmpty(visibleRowIndices)) {
var horizontalOffsetAdjustment = this._columnSizeAndPositionManager.getOffsetAdjustment(width, scrollLeft); var horizontalOffsetAdjustment = this._columnSizeAndPositionManager.getOffsetAdjustment(width, scrollLeft);
var verticalOffsetAdjustment = this._rowSizeAndPositionManager.getOffsetAdjustment(height, scrollTop); var verticalOffsetAdjustment = this._rowSizeAndPositionManager.getOffsetAdjustment(height, scrollTop);
@ -164,7 +164,6 @@ BI.GridView = BI.inherit(BI.Widget, {
return; return;
} }
var renderedCells = [], renderedKeys = {}, renderedWidgets = {};
var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0; var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0;
var count = 0; var count = 0;
for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) { for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
@ -225,6 +224,7 @@ BI.GridView = BI.inherit(BI.Widget, {
count++; count++;
} }
} }
}
// 已存在的, 需要添加的和需要删除的 // 已存在的, 需要添加的和需要删除的
var existSet = {}, addSet = {}, deleteArray = []; var existSet = {}, addSet = {}, deleteArray = [];
BI.each(renderedKeys, function (i, key) { BI.each(renderedKeys, function (i, key) {

Loading…
Cancel
Save