You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/03/07 11:58:52 UTC

[royale-asjs] branch develop updated: jewel-datagrid: fix when dg can surround a container and its height is percentual so it need to not overflow the container and adapt to the container's height

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

carlosrovira 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 0b9a353  jewel-datagrid: fix when dg can surround a container and its height is percentual so it need to not overflow the container and adapt to the container's height
0b9a353 is described below

commit 0b9a3538f7c2eda0a7ffc5613b9c37c6f2ba98b2
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Mar 7 12:58:42 2020 +0100

    jewel-datagrid: fix when dg can surround a container and its height is percentual so it need to not overflow the container and adapt to the container's height
---
 frameworks/projects/Jewel/src/main/resources/defaults.css        | 1 +
 .../org/apache/royale/jewel/beads/layouts/DataGridLayout.as      | 9 +++++----
 .../projects/Jewel/src/main/sass/components/_datagrid.sass       | 1 +
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index aad6388..75433bf 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -508,6 +508,7 @@ j|VirtualComboBoxPopUp {
   display: flex;
   flex-direction: column;
   position: relative;
+  overflow: auto;
 }
 .jewel.datagrid .jewel.buttonbar.header {
   width: 100%;
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as
index b54f678..4ecaf31 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/DataGridLayout.as
@@ -109,10 +109,12 @@ package org.apache.royale.jewel.beads.layouts
             var bblayout:ButtonBarLayout = header.getBeadByType(ButtonBarLayout) as ButtonBarLayout;
 			// (header as ButtonBar).widthType = ButtonBarModel.PROPORTIONAL_WIDTHS;
 			var listArea:IUIBase = view.listArea;
+			var scrollbead:ScrollingViewport = listArea.getBeadByType(IScrollingViewport) as ScrollingViewport;
 			
 			var displayedColumns:Array = view.columnLists;
 			var model:IDataGridModel = datagrid.model as IDataGridModel;
 			
+			// Width
 			var defaultColumnWidth:Number;
 			if(!datagrid.percentWidth)
 			{
@@ -129,12 +131,14 @@ package org.apache.royale.jewel.beads.layouts
 				var columnList:UIBase = displayedColumns[i] as UIBase;
 
 				//remove columns height if rows not surround datagrid height (and this one is set to pixels)
-				if(model.dataProvider && isNaN(datagrid.percentHeight) && (model.dataProvider.length * presentationModel.rowHeight) > listArea.height)
+				if(model.dataProvider && (model.dataProvider.length * presentationModel.rowHeight) > (datagrid.height - header.height))
 				{
 					columnList.height = NaN;
+					scrollbead.scroll = true;
 				} else 
 				{
 					columnList.percentHeight = 100;
+					scrollbead.scroll = false;
 				}
 
 				//temporal- if only one isNaN(columnDef.columnWidth) make it true so widthType = ButtonBarModel.PIXEL_WIDTHS
@@ -153,9 +157,6 @@ package org.apache.royale.jewel.beads.layouts
 				columnWidths.push(columnWidth);
 			}
 
-			var scrollbead:ScrollingViewport = listArea.getBeadByType(IScrollingViewport) as ScrollingViewport;
-            scrollbead.scroll = model.dataProvider && (model.dataProvider.length * presentationModel.rowHeight) > listArea.height;
-			
 			bbmodel.buttonWidths = columnWidths;
 			if(pixelflag)
 			{
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_datagrid.sass b/frameworks/projects/Jewel/src/main/sass/components/_datagrid.sass
index 7440400..2b42549 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_datagrid.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_datagrid.sass
@@ -24,6 +24,7 @@
     display: flex
     flex-direction: column
     position: relative
+    overflow: auto
     
     .jewel.buttonbar.header
         width: 100%