From a2e035d4bb4bc55f5367c9986f92251864b07a44 Mon Sep 17 00:00:00 2001 From: Kobi Date: Thu, 23 Nov 2023 09:53:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-138976=20fix:=20=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 2a547dca1e11670822a72eff9134d2286b32dc97) --- .../fineui/src/base/list/virtualgrouplist.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index e2e0d5ddf..143c867fa 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -77,6 +77,7 @@ export class VirtualGroupList extends Widget { this.populate(newValue); }) : o.items; + this._calculateSummaryHeight(); this._populate(); this.ticking = false; this.element.scroll(() => { @@ -169,6 +170,16 @@ export class VirtualGroupList extends Widget { ); } } + + _calculateSummaryHeight() { + const o = this.options; + if (isFunction(o.rowHeight)) { + this.summaryHeight = sum(o.items, o.rowHeight); + } else { + this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length; + } + } + _populate(items) { const { blockSize, rowHeight, scrollTop } = this.options; if (items && this.options.items !== items) { @@ -198,13 +209,8 @@ export class VirtualGroupList extends Widget { } _restore() { - const o = this.options; this.renderedIndex = -1; - if (isFunction(o.rowHeight)) { - this.summaryHeight = sum(o.items, o.rowHeight); - } else { - this.summaryHeight = this._isAutoHeight() ? 0 : o.rowHeight * o.items.length; - } + this._calculateSummaryHeight(); // 依赖于cache的占位元素也要初始化 this.topBlank.setHeight(0); this.bottomBlank.setHeight(0); From fd728117a276e3a7d99790629b3811686aff9f34 Mon Sep 17 00:00:00 2001 From: Kobi Date: Thu, 23 Nov 2023 15:39:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-138976=20fix:=20=E5=9C=A8init=E4=B8=AD?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 6f04b657839f5640fbb51e07a1d639cbe3e7babc) --- packages/fineui/src/base/list/virtualgrouplist.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index 143c867fa..862de946d 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -25,6 +25,7 @@ export class VirtualGroupList extends Widget { } init() { + this._calculateSummaryHeight(); this.renderedIndex = -1; } @@ -44,7 +45,7 @@ export class VirtualGroupList extends Widget { }, { type: VirtualGroup.xtype, - height: rowHeight * items.length, + height: this.summaryHeight, ref: (ref) => { this.container = ref; }, @@ -77,7 +78,6 @@ export class VirtualGroupList extends Widget { this.populate(newValue); }) : o.items; - this._calculateSummaryHeight(); this._populate(); this.ticking = false; this.element.scroll(() => {