You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/12/03 20:48:58 UTC

[royale-asjs] 02/02: handle 0 length collections better. Should fix #601

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 5d33708e5a31011c2fd729fb1892bba09e78eddb
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Dec 3 12:48:40 2019 -0800

    handle 0 length collections better.  Should fix #601
---
 ...taItemRendererFactoryForICollectionViewAdvancedDataGridData.as | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/advancedDataGridClasses/DataItemRendererFactoryForICollectionViewAdvancedDataGridData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/advancedDataGridClasses/DataItemRendererFactoryForICollectionViewAdvancedDataGridData.as
index 49854dd..e711db8 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/advancedDataGridClasses/DataItemRendererFactoryForICollectionViewAdvancedDataGridData.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/advancedDataGridClasses/DataItemRendererFactoryForICollectionViewAdvancedDataGridData.as
@@ -115,7 +115,7 @@ package mx.controls.advancedDataGridClasses
                 return;
             
             cursor = dp.createCursor();
-            currentIndex = 0;
+            currentIndex = (dp.length > 0) ? 0 : -1;
             
             // listen for individual items being added in the future.
             //var dped:IEventDispatcher = dp as IEventDispatcher;
@@ -206,7 +206,11 @@ package mx.controls.advancedDataGridClasses
                 UIBase(ir).percentWidth = 100;
             }
             var delta:int = index - currentIndex;
-            if (delta == -1)
+            if (currentIndex == -1)
+            {
+                cursor.seek(CursorBookmark.FIRST, index);                
+            }
+            else if (delta == -1)
             {
                 cursor.movePrevious();
             }