flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saju Thankathurai (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-34359) RTE when accessing gridDimensions
Date Mon, 09 Jun 2014 07:40:01 GMT

    [ https://issues.apache.org/jira/browse/FLEX-34359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14021727#comment-14021727
] 

Saju Thankathurai commented on FLEX-34359:
------------------------------------------

Sample Code to reproduce is mentioned below.

Error occurs in 
const dimensions:GridDimensions = grid.mx_internal::gridDimensions;  during runtime on dragging
the header 



<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
					   xmlns:s="library://ns.adobe.com/flex/spark"
					   xmlns:mx="library://ns.adobe.com/flex/mx"
					   initialize="initData()">
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.core.mx_internal;
			import mx.events.FlexEvent;
			
			import spark.components.Grid;
			import spark.components.GridColumnHeaderGroup;
			import spark.components.gridClasses.GridDimensions;
			import spark.events.GridEvent;
			
			
			
			private var dgArray:Array = [
				{Artist: 'Pavement', Album: 'Slanted and Enchanted', Price: 11.99},
				{Artist: 'Pavement', Album: 'Brighten the Corners', Price: 11.99}
			];
			[Bindable]
			public var initDG:ArrayCollection;
			private var dragging:Boolean;
			// Initialize initDG variable from the Array.
			public function initData():void {
				initDG = new ArrayCollection(dgArray);
				this.nativeWindow.maximize();
			}
			
			private function myGrid_creationCompleteHandler(event:FlexEvent):void {
				var dg:DataGrid = event.currentTarget as DataGrid;
				dg.removeEventListener(FlexEvent.CREATION_COMPLETE, myGrid_creationCompleteHandler);
				
				dg.columnHeaderGroup.addEventListener(GridEvent.SEPARATOR_MOUSE_DRAG, separatorMouseDragHandler);
				dg.columnHeaderGroup.addEventListener(GridEvent.SEPARATOR_MOUSE_UP, separatorMouseUpHandler);
			}
			
			private function separatorMouseDragHandler(event:GridEvent):void {
				const headerGroup:GridColumnHeaderGroup = event.currentTarget as GridColumnHeaderGroup;
				if (headerGroup.dataGrid.columnsLength > 1 && event.columnIndex < event.grid.columns.length
-1) {
					dragging = true;
				}
			}
			
			private static const BOUND_LIMIT:int = 5;
			private static const BOUND_SPACE:int = 5;
			
			private function separatorMouseUpHandler(event:GridEvent):void {
				if (dragging) {
					dragging = false;
					const columnIndex:int = event.columnIndex;
					const headerGroup:GridColumnHeaderGroup = event.currentTarget as GridColumnHeaderGroup;
					
					const grid:Grid = event.grid;
					
					const visibleColumnIndices:Vector.<int> = grid.getVisibleColumnIndices();
					
					const isVisible:Boolean = visibleColumnIndices.indexOf(columnIndex) > -1;
					if (visibleColumnIndices.length >= columnIndex + 1 && isVisible) {
						const dimensions:GridDimensions = grid.mx_internal::gridDimensions;
						const visibleColumnsWidthBeforeOur:Number = dimensions.getContentWidth(columnIndex);
						const visibleColumnsWidthUpToOur:Number = dimensions.getContentWidth(columnIndex + 1);
						if (visibleColumnsWidthUpToOur + BOUND_LIMIT > grid.width) {
							const newWidth:Number = grid.width - visibleColumnsWidthBeforeOur - BOUND_LIMIT;
							event.column.width = newWidth;
						}
					}
				}
			}
				
			
		]]>
	</fx:Script>
	<s:DataGrid id="myGrid" x="50" y="50"
				width="1000" height="500" 
				dataProvider="{initDG}"
				horizontalScrollPolicy="off"
				creationComplete="myGrid_creationCompleteHandler(event)"/>
</s:WindowedApplication>

> RTE when accessing gridDimensions
> ---------------------------------
>
>                 Key: FLEX-34359
>                 URL: https://issues.apache.org/jira/browse/FLEX-34359
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: DataGrid
>    Affects Versions: Adobe Flex SDK 4.6 (Release)
>         Environment: Windows 7 Enterprise edition, Adobe Flash builder 4.7 Premium
>            Reporter: Saju Thankathurai
>              Labels: Apache
>
> Getting a RunTime Error on accessing gridDimensions.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message