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/02/25 20:03:00 UTC

[royale-asjs] branch develop updated: tour-de-jewel: example for datagridcolumn labels change (see #729)

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 573101d  tour-de-jewel: example for datagridcolumn labels change (see #729)
573101d is described below

commit 573101d714752f27ba33a66daf9da96b342b77b1
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Tue Feb 25 21:02:47 2020 +0100

    tour-de-jewel: example for datagridcolumn labels change (see #729)
---
 .../src/main/royale/DataGridPlayGround.mxml        | 59 ++++++++++++++--------
 1 file changed, 38 insertions(+), 21 deletions(-)

diff --git a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
index de177b3..4f7f0e3 100644
--- a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
@@ -33,6 +33,7 @@ limitations under the License.
 
         import vos.IconListVO;
         import vos.Product;
+        import org.apache.royale.jewel.supportClasses.datagrid.IDataGridPresentationModel;
 
         private function dataGridProductChange(grid:DataGrid, output:Label) : void
 		{
@@ -100,6 +101,15 @@ limitations under the License.
 
 		[Bindable]
 		public var listModel:ListsModel = new ListsModel();
+
+		/**
+		 * DataGridColumnLabelsChange nead needed
+		 */
+		public function changeColumnNames():void
+		{
+			var pm:IDataGridPresentationModel = datagrid.presentationModel as IDataGridPresentationModel;
+			pm.columnLabels = ["Imgs", "Names", "Cost"];
+		}
 		]]>
 	</fx:Script>
 
@@ -118,34 +128,41 @@ limitations under the License.
 
 		<c:ExampleHeader title="Jewel DataGrid">
 			<c:description>
-				<![CDATA[<strong>Jewel DataGrid</strong> examples.]]>
+				<![CDATA[<b>Jewel DataGrid</b> examples.]]>
 			</c:description>
 		</c:ExampleHeader>
 
 		<j:GridCell desktopNumerator="1" desktopDenominator="2" tabletNumerator="1" tabletDenominator="2" phoneNumerator="1" phoneDenominator="1">
 			<j:Card>
-				<html:H3 text="Jewel DataGrid"/>
-				
-				<j:Label text="Basic configuration, default width, no column widths, no rowHeight. First column uses a custom renderer."
-						multiline="true"/>
+				<j:CardHeader>
+					<html:H3 text="Jewel DataGrid" className="primary-normal"/>
+				</j:CardHeader>
+				<j:CardPrimaryContent>
+					<j:Label text="Basic configuration, default width, no column widths, no rowHeight. First column uses a custom renderer."
+							multiline="true"/>
 
-				<j:DataGrid localId="datagrid"
-					change="dataGridProductChange(event.target as DataGrid, datagrid_lb)">
-					<j:beads>
-						<js:ConstantBinding
-							sourceID="productModel"
-							sourcePropertyName="fewProductList"
-							destinationPropertyName="dataProvider"/>
-					</j:beads>
-					<j:columns>
-						<j:DataGridColumn label="Images" dataField="image" 
-										itemRenderer="itemRenderers.ImageDataGridItemRenderer"/>
-						<j:DataGridColumn label="Title" dataField="title"/>
-						<j:DataGridColumn label="Sales" dataField="sales"/>
-					</j:columns>
-				</j:DataGrid>
+					<j:DataGrid localId="datagrid"
+						change="dataGridProductChange(event.target as DataGrid, datagrid_lb)">
+						<j:beads>
+							<js:ConstantBinding
+								sourceID="productModel"
+								sourcePropertyName="fewProductList"
+								destinationPropertyName="dataProvider"/>
+							<j:DataGridColumnLabelsChange/>
+						</j:beads>
+						<j:columns>
+							<j:DataGridColumn label="Images" dataField="image" 
+											itemRenderer="itemRenderers.ImageDataGridItemRenderer"/>
+							<j:DataGridColumn label="Title" dataField="title"/>
+							<j:DataGridColumn label="Sales" dataField="sales"/>
+						</j:columns>
+					</j:DataGrid>
 
-				<j:Label id="datagrid_lb" text="DataGrid selection will be shown here"/>
+					<j:Label id="datagrid_lb" text="DataGrid selection will be shown here"/>
+				</j:CardPrimaryContent>
+				<j:CardActions>
+					<j:Button text="change column labels" click="changeColumnNames()"/>
+				</j:CardActions>
 			</j:Card>
 		</j:GridCell>