From 6d3f0a03ae736c662416560f0332e2891796f76e Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 22 Sep 2021 19:28:21 +0800 Subject: [PATCH] =?UTF-8?q?grid=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/collection/collection.js | 8 ++++---- src/base/grid/grid.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 804e5c6fd..871d77d4d 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -279,14 +279,14 @@ BI.CollectionView = BI.inherit(BI.Widget, { if (o.items.length > 0) { this.container.setWidth(this._width); this.container.setHeight(this._height); + + this._debounceRelease(); // 元素未挂载时不能设置scrollTop try { this.element.scrollTop(o.scrollTop); this.element.scrollLeft(o.scrollLeft); } catch (e) { } - - this._debounceRelease(); this._calculateChildrenToRender(); } }, @@ -298,8 +298,8 @@ BI.CollectionView = BI.inherit(BI.Widget, { this._scrollLock = true; this.options.scrollLeft = BI.clamp(scrollLeft || 0, 0, this._getMaxScrollLeft()); this._debounceRelease(); - this._calculateChildrenToRender(); this.element.scrollLeft(this.options.scrollLeft); + this._calculateChildrenToRender(); }, setScrollTop: function (scrollTop) { @@ -309,8 +309,8 @@ BI.CollectionView = BI.inherit(BI.Widget, { this._scrollLock = true; this.options.scrollTop = BI.clamp(scrollTop || 0, 0, this._getMaxScrollTop()); this._debounceRelease(); - this._calculateChildrenToRender(); this.element.scrollTop(this.options.scrollTop); + this._calculateChildrenToRender(); }, setOverflowX: function (b) { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 6d489cf34..50b45295e 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -262,14 +262,14 @@ BI.GridView = BI.inherit(BI.Widget, { if (o.items.length > 0) { this.container.setWidth(this._getContainerWidth()); this.container.setHeight(this._getContainerHeight()); + // 元素未挂载时不能设置scrollTop + this._debounceRelease(); try { this.element.scrollTop(o.scrollTop); this.element.scrollLeft(o.scrollLeft); } catch (e) { } - - this._debounceRelease(); this._calculateChildrenToRender(); } }, @@ -281,8 +281,8 @@ BI.GridView = BI.inherit(BI.Widget, { this._scrollLock = true; this.options.scrollLeft = BI.clamp(scrollLeft || 0, 0, this._getMaxScrollLeft()); this._debounceRelease(); - this._calculateChildrenToRender(); this.element.scrollLeft(this.options.scrollLeft); + this._calculateChildrenToRender(); }, setScrollTop: function (scrollTop) { @@ -292,8 +292,8 @@ BI.GridView = BI.inherit(BI.Widget, { this._scrollLock = true; this.options.scrollTop = BI.clamp(scrollTop || 0, 0, this._getMaxScrollTop()); this._debounceRelease(); - this._calculateChildrenToRender(); this.element.scrollTop(this.options.scrollTop); + this._calculateChildrenToRender(); }, setColumnCount: function (columnCount) {