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

yishayw 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 111dbe9  stop forcing size of DG to 200x200 and try measuring based on 
rowHeight and number of rows in DG when set
111dbe9 is described below

commit 111dbe9b9a2217d936a1ec2ee99d36a36ed94098
Author: Alex Harui <[email protected]>
AuthorDate: Tue Dec 15 23:11:59 2020 -0800

    stop forcing size of DG to 200x200 and try measuring based on rowHeight and 
number of rows in DG when set
---
 .../MXRoyale/src/main/resources/defaults.css         |  2 --
 .../mx/controls/listClasses/DataGridListBase.as      | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css 
b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 9a16916..46c168b 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -242,8 +242,6 @@ DataGrid
        
        background-color: #FFFFFF;
        border: 1px solid #222222;
-       width: 200px;
-       height: 200px;
 }
 
 DataGridColumnList {
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
index 29dc2f9..f683db4 100644
--- 
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
@@ -74,6 +74,7 @@ import org.apache.royale.core.IParent;
 import org.apache.royale.core.ISelectionModel;
 import org.apache.royale.core.IUIBase;
 import org.apache.royale.events.Event;
+import org.apache.royale.events.IEventDispatcher;
 import org.apache.royale.events.MouseEvent;
 import org.apache.royale.geom.Point;
 import org.apache.royale.utils.loadBeadFromValuesManager;
@@ -580,6 +581,18 @@ public class DataGridListBase extends ListBase /* extends 
UIComponent
         clearSelectionData();
         (model as ISelectionModel).selectedIndex = -1;
         super.dataProvider = value;
+               if (isWidthSizedToContent() || isHeightSizedToContent()) 
+               {
+                       invalidateSize();
+                       if (parent) 
+                       {
+                               // if we're sized to content and parent doesn't 
have explicitWidth
+                               // meaning it is sizedToContent or may be % but 
depending on
+                               // minHeight measurement, then force a layout
+                               if (isHeightSizedToContent() && isNaN((parent 
as UIComponent).explicitHeight))                  
+                                       (parent as 
IEventDispatcher).dispatchEvent("layoutNeeded");
+                       }
+               }
 
     }
 
@@ -1747,6 +1760,13 @@ public class DataGridListBase extends ListBase /* 
extends UIComponent
         addClipMask((offscreenExtraRowsTop != oldoffscreenExtraRowsTop) || 
(offscreenExtraRowsBottom != oldoffscreenExtraRowsBottom));
     } */
 
+    override public function get measuredHeight():Number
+    {
+               if (dataProvider && dataProvider.length && !isNaN(rowHeight))
+                   return dataProvider.length * rowHeight;
+               return super.measuredHeight;
+    }
+
     
//--------------------------------------------------------------------------
     //
     //  Properties

Reply via email to