This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 73457e254b9872c4d8921fffef9e027cbe2ad836 Author: Alex Harui <aha...@apache.org> AuthorDate: Tue Nov 12 23:33:05 2019 -0800 try a different virtual scrolling trick. Should fix #554 --- .../beads/layouts/AdvancedDataGridLayout.as | 41 +++++++++------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/layouts/AdvancedDataGridLayout.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/layouts/AdvancedDataGridLayout.as index 6bf8694..2f2d660 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/layouts/AdvancedDataGridLayout.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/layouts/AdvancedDataGridLayout.as @@ -63,10 +63,7 @@ package mx.controls.beads.layouts } COMPILE::JS - protected var topSpacer:HTMLDivElement; - - COMPILE::JS - protected var bottomSpacer:HTMLDivElement; + protected var spacer:HTMLDivElement; COMPILE::JS private var listening:Boolean; @@ -108,6 +105,22 @@ package mx.controls.beads.layouts var topSpacerHeight:Number = Math.floor(listArea.element.scrollTop / presentationModel.rowHeight) * presentationModel.rowHeight; } + var model:IDataGridModel = uiHost.model as IDataGridModel; + if (model.dataProvider && model.dataProvider.length) + { + var totalHeight:Number = model.dataProvider.length * presentationModel.rowHeight; + COMPILE::JS + { + if (!spacer) + { + spacer = document.createElement("div") as HTMLDivElement; + listArea.element.appendChild(spacer); + } + // the lists are "absolute" so they float over the spacer + spacer.style.height = totalHeight.toString() + "px"; + topSpacerHeight = Math.min(topSpacerHeight, totalHeight - useHeight); + } + } for (var i:int = 0; i < n; i++) { var columnList:UIBase = displayedColumns[i] as UIBase; @@ -119,26 +132,6 @@ package mx.controls.beads.layouts columnList.dispatchEvent(new Event("layoutNeeded")); } } - var model:IDataGridModel = uiHost.model as IDataGridModel; - if (model.dataProvider && model.dataProvider.length) - { - var totalHeight:Number = model.dataProvider.length * presentationModel.rowHeight; - COMPILE::JS - { - if (!topSpacer) - { - topSpacer = document.createElement("div") as HTMLDivElement; - listArea.element.insertBefore(topSpacer, (listArea as UIBase).internalChildren()[0]); - } - topSpacer.style.height = topSpacerHeight.toString() + "px"; - if (!bottomSpacer) - { - bottomSpacer = document.createElement("div") as HTMLDivElement; - listArea.element.appendChild(bottomSpacer); - } - bottomSpacer.style.height = (totalHeight - useHeight - topSpacerHeight).toString() + "px"; - } - } } return retval; }