You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by hu...@apache.org on 2022/11/27 13:13:11 UTC

[royale-asjs] branch develop updated: Fix: Scroll in VirtualDataGrid was unusable with more than 2 columns

This is an automated email from the ASF dual-hosted git repository.

hugoferreira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new df1ef47922 Fix: Scroll in VirtualDataGrid was unusable with more than 2 columns
df1ef47922 is described below

commit df1ef47922c48c1f28f6ee3fb8eaefc45f45e20d
Author: Hugo Ferreira <hf...@solidsoft.pt>
AuthorDate: Sun Nov 27 12:58:29 2022 +0000

    Fix: Scroll in VirtualDataGrid was unusable with more than 2 columns
    
    VirtualDataGrid was not usable for more than 2 columns because as soon the user made a faster vertical scroll or reposition to another line, all the VirtualDataGrid was messed up.
    With this fix (tested with 6 columns and thousands of records) this fix finally fix this issue.
    Also, currently to have the VirtualDataGrid working propertly with many records, the DataGridScrollSpeed bead with a minimum speed about 0.5 is needed to emulate the scroll at same speed.
---
 .../beads/layouts/VirtualDataGridListAreaLayout.as   | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualDataGridListAreaLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualDataGridListAreaLayout.as
index 65f1a5dff7..8304bc9ff6 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualDataGridListAreaLayout.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualDataGridListAreaLayout.as
@@ -20,6 +20,7 @@ package org.apache.royale.jewel.beads.layouts
 {
     import org.apache.royale.events.Event;
     import org.apache.royale.html.beads.IDataGridView;
+	import org.apache.royale.core.IStrand;
     import org.apache.royale.core.IDataGrid;
     import org.apache.royale.jewel.Container;
     import org.apache.royale.jewel.supportClasses.datagrid.IDataGridColumnList;
@@ -34,6 +35,8 @@ package org.apache.royale.jewel.beads.layouts
 	 */
 	public class VirtualDataGridListAreaLayout extends VirtualListVerticalLayout
 	{
+        private var isAreaFocus:Boolean;
+
 		/**
 		 *  Constructor.
 		 *
@@ -48,6 +51,17 @@ package org.apache.royale.jewel.beads.layouts
 			super();
 		}
 
+        override public function set strand(value:IStrand):void
+        {
+            super.strand = value;
+
+            COMPILE::JS
+            {
+                host.element.addEventListener("mouseover", function():void { isAreaFocus = true });
+                host.element.addEventListener("mouseleave", function():void { isAreaFocus = false });
+            }
+        }
+
         private function getListArea():Container
         {
             var datagrid:IDataGrid = (host as IDataGridColumnList).datagrid;
@@ -59,6 +73,12 @@ package org.apache.royale.jewel.beads.layouts
         {
             super.scrollHandler(e);
 
+            //this is not ideal, but avoids that the other VirtualDataGrid columns
+            //also try to do scrollTop to all columns again in a loop, that causes a performance issue
+            //and a strang behaviour on the first column that started the process
+            if (!isAreaFocus)
+                return;
+
             var listArea:Container = getListArea();
 
             for (var i:int = 0; i < listArea.numElements; i++)