From 2e0480638ecb67380a9d24fa5b4fab06a3cba183 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 23 Sep 2021 14:09:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-94391=20fix:=20grid=20populate=E7=A9=BA?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E6=BB=9A=E5=8A=A8=E6=9D=A1=E4=BB=8D=E7=84=B6?= =?UTF-8?q?=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/grid/grid.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 50b45295e..436328ca6 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -271,6 +271,9 @@ BI.GridView = BI.inherit(BI.Widget, { } catch (e) { } this._calculateChildrenToRender(); + } else { + this.container.setWidth("auto"); + this.container.setHeight("auto"); } }, From 6b1c1305138e5edb7cb694636710d73352176992 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 23 Sep 2021 17:12:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/collection/collection.js | 20 +++++++++----------- src/base/grid/grid.js | 25 ++++++++++--------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 871d77d4d..fa16883e4 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -276,19 +276,17 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.options.items = items; this._calculateSizeAndPositionData(); } - if (o.items.length > 0) { - this.container.setWidth(this._width); - this.container.setHeight(this._height); + 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._calculateChildrenToRender(); + this._debounceRelease(); + // 元素未挂载时不能设置scrollTop + try { + this.element.scrollTop(o.scrollTop); + this.element.scrollLeft(o.scrollLeft); + } catch (e) { } + this._calculateChildrenToRender(); }, setScrollLeft: function (scrollLeft) { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 3cfa530c4..6096a28c5 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -262,22 +262,17 @@ BI.GridView = BI.inherit(BI.Widget, { this.options.items = items; this._calculateSizeAndPositionData(); } - 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._calculateChildrenToRender(); - } else { - this.container.setWidth("auto"); - this.container.setHeight("auto"); + 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._calculateChildrenToRender(); }, setScrollLeft: function (scrollLeft) {