Return-Path: X-Original-To: apmail-flex-dev-archive@www.apache.org Delivered-To: apmail-flex-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2171811A6A for ; Mon, 9 Jun 2014 04:46:13 +0000 (UTC) Received: (qmail 1670 invoked by uid 500); 9 Jun 2014 04:46:12 -0000 Delivered-To: apmail-flex-dev-archive@flex.apache.org Received: (qmail 1627 invoked by uid 500); 9 Jun 2014 04:46:12 -0000 Mailing-List: contact dev-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list dev@flex.apache.org Received: (qmail 1616 invoked by uid 99); 9 Jun 2014 04:46:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jun 2014 04:46:12 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=HTML_FONT_FACE_BAD,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sathikeshjith@gmail.com designates 209.85.128.169 as permitted sender) Received: from [209.85.128.169] (HELO mail-ve0-f169.google.com) (209.85.128.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jun 2014 04:46:07 +0000 Received: by mail-ve0-f169.google.com with SMTP id jx11so6001577veb.28 for ; Sun, 08 Jun 2014 21:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=8C7wYawkv8CVs0pWbR9+m7kGRWa1phguwvTcXjlzyYk=; b=0GgbHJF6MSZneUuMM6HxnQ6yB7KLJATY532VFWtyXthxInKaaYan9sBu8WGfPTTRKJ 18S1BNjG92oM6JnMlrxNpYe5Lf1fKdDq+zllDxuzrSJdohMLzmqp0Rh73CQczfMGzWVb yVn3ebfEBNPG4wznJgrIDFkiBdCcsmDkKvecKOblmCrWLBcqlRrUSe6uWgpDlaPstZnW EIDZuE4qQN3DZFMkJEEW9bf/FPYzGgBi4OT6GMEDRIPdGCwYcUDi6hE5WStGZVfAByr+ QEZIeMdKAbcWJOMuVSE9nlLmKjtXg3TaRBNgpBqEuMmN6KmsX1j5gFsS9xQfzQpaAz9M EGNA== X-Received: by 10.221.30.14 with SMTP id sa14mr21859662vcb.44.1402289146220; Sun, 08 Jun 2014 21:45:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.245.98 with HTTP; Sun, 8 Jun 2014 21:45:26 -0700 (PDT) In-Reply-To: References: From: Saju Thankathurai Date: Mon, 9 Jun 2014 10:15:26 +0530 Message-ID: Subject: Re: Spark datagrid Issue. To: "dev@flex.apache.org" Content-Type: multipart/alternative; boundary=001a11336a2e6ed48304fb5fe204 X-Virus-Checked: Checked by ClamAV on apache.org --001a11336a2e6ed48304fb5fe204 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, Have one runtime exception. ReferenceError: Error #1069: Property http://www.adobe.com/2006/flex/mx/internal::gridDimensions not found on spark.components.Grid and there is no default value. in the code const dimensions:GridDimensions =3D grid.mx_internal::gridDimensions; On Sat, Jun 7, 2014 at 8:34 PM, Fr=C3=A9d=C3=A9ric THOMAS wrote: > or even better: > > private function separatorMouseDragHandler(event:GridEvent):void = { > const headerGroup:GridColumnHeaderGroup =3D event.currentTarg= et > as GridColumnHeaderGroup; > if (headerGroup.dataGrid.columnsLength > 1 && > event.columnIndex < event.grid.columns.length -1) { > dragging =3D true; > } > } > > private static const BOUND_LIMIT:int =3D 5; > > private function separatorMouseUpHandler(event:GridEvent):void { > if (dragging) { > dragging =3D false; > const columnIndex:int =3D event.columnIndex; > const headerGroup:GridColumnHeaderGroup =3D > event.currentTarget as GridColumnHeaderGroup; > const grid:Grid =3D event.grid; > const visibleColumnIndices:Vector. =3D > grid.getVisibleColumnIndices(); > const isVisible:Boolean =3D > visibleColumnIndices.indexOf(columnIndex) > -1; > if (visibleColumnIndices.length >=3D columnIndex + 1 && > isVisible) { > const dimensions:GridDimensions =3D > grid.mx_internal::gridDimensions; > const visibleColumnsWidthBeforeOur:Number =3D > dimensions.getContentWidth(columnIndex); > const visibleColumnsWidthUpToOur:Number =3D > dimensions.getContentWidth(columnIndex + 1); > if (visibleColumnsWidthUpToOur + BOUND_LIMIT > > grid.width) { > const newWidth:Number =3D grid.width - > visibleColumnsWidthBeforeOur - BOUND_LIMIT; > event.column.width =3D newWidth; > } > } > } > } > > Note: I used const instead of var because I was doing java today but > there's no differences in AS3, they are compiled in the same bytecode. > > Fr=C3=A9d=C3=A9ric THOMAS > > > From: webdoublefx@hotmail.com > > To: dev@flex.apache.org > > Subject: RE: Spark datagrid Issue. > > Date: Sat, 7 Jun 2014 15:02:19 +0100 > > > > Hi Saju, > > > > I guess this topic would fit better in the user mailing list, hower, no= t > sure I understood your question, anyway I assumed you meant drag (instead > of scroll) the header because in a Spark DataGrid, the header is not > drag-able, so, to restrict the size of the header to make at least one > other column header to stay visible, I would do something like this: > > > > > > > xmlns:s=3D"library://ns.adobe.com/flex/spark" > > xmlns:mx=3D"library://ns.adobe.com/flex/mx" > > initialize=3D"initData()"> > > > > > import mx.collections.*; > > import mx.events.FlexEvent; > > > > import spark.components.Grid; > > > > import spark.components.GridColumnHeaderGroup; > > import spark.components.gridClasses.GridDimensions; > > > > import spark.events.GridEvent; > > > > import mx.core.mx_internal; > > > > private var dgArray:Array =3D [ > > {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 =3D new ArrayCollection(dgArray); > > } > > > > private function > myGrid_creationCompleteHandler(event:FlexEvent):void { > > var dg:DataGrid =3D 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):voi= d > { > > const headerGroup:GridColumnHeaderGroup =3D > event.currentTarget as GridColumnHeaderGroup; > > if (headerGroup.dataGrid.columnsLength > 1) { > > dragging =3D true; > > } > > } > > > > private static const BOUND_SPACE:int =3D 5; > > > > private function separatorMouseUpHandler(event:GridEvent):void = { > > if (dragging) { > > dragging =3D false; > > const columnIndex:int =3D event.columnIndex; > > const headerGroup:GridColumnHeaderGroup =3D > event.currentTarget as GridColumnHeaderGroup; > > const grid:Grid =3D event.grid; > > const visibleColumnIndices:Vector. =3D > grid.getVisibleColumnIndices(); > > const isVisible:Boolean =3D > visibleColumnIndices.indexOf(columnIndex) > -1; > > if (visibleColumnIndices.length >=3D columnIndex + 1 && > isVisible) { > > const visibleColumnsWidthBeforeOur:Number =3D > grid.mx_internal::gridDimensions.getContentWidth(columnIndex); > > const visibleColumnsWidthUpToOur:Number =3D > grid.mx_internal::gridDimensions.getContentWidth(columnIndex + 1); > > if (visibleColumnsWidthUpToOur + BOUND_SPACE > > grid.width) { > > const newWidth:Number =3D > visibleColumnsWidthUpToOur - visibleColumnsWidthBeforeOur - BOUND_SPACE; > > event.column.width =3D newWidth; > > } > > } > > } > > } > > ]]> > > > > > width=3D"350" height=3D"200" > > dataProvider=3D"{initDG}" > > horizontalScrollPolicy=3D"off" > > > creationComplete=3D"myGrid_creationCompleteHandler(event)"/> > > > > > > HTH, > > Fr=C3=A9d=C3=A9ric THOMAS > > > > > Date: Sat, 7 Jun 2014 16:23:16 +0530 > > > Subject: Fwd: Spark datagrid Issue. > > > From: sathikeshjith@gmail.com > > > To: dev@flex.apache.org > > > > > > Any help in this regard.. > > > > > > -- > > > Saju Thankathurai > > > > > > Sent from my Samsung Galaxy Ace. > > > ---------- Forwarded message ---------- > > > From: "Saju Thankathurai" > > > Date: 7 Jun 2014 08:06 > > > Subject: Spark datagrid Issue. > > > To: "users@flex.apache.org" > > > > > > Hi, > > > > > > I have a spark flex datagrid. I have set its horizontalscrollpolicy t= o > off. > > > When i scroll the header towards right completely, the header is move= d > and > > > is not visible. This makes an impression that there are no more > columns in > > > the grid. > > > > > > Is there a way to restrict the columns to a certain limit towards rig= ht > > > when scrolling > > > > > > Grid has 3 columns > > > [1]. > > > > https://drive.google.com/file/d/0ByEkeIgKzyCaOXlVaDJ0ckhHLWM/edit?usp=3Ds= haring > > > > > > > > > After scrolling the 2nd column towards right, It makes an impression > that > > > there is only one column available. > > > [2] > > > > https://drive.google.com/file/d/0ByEkeIgKzyCaUkR4WV91cDE1Y0E/edit?usp=3Ds= haring > > > > > > Code: > > > > > > > > > > > xmlns:s=3D"library://ns.adobe.com/flex/spark" > > > xmlns:mx=3D"library://ns.adobe.com/flex/mx" > > > initialize=3D"initData()"> > > > > > > > > import mx.collections.*; > > > private var dgArray:Array =3D [ > > > {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99}, > > > {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99}]; > > > [Bindable] > > > public var initDG:ArrayCollection; > > > // Initialize initDG variable from the Array. > > > public function initData():void { > > > initDG =3D new ArrayCollection(dgArray); > > > } > > > ]]> > > > > > > > > width=3D"350" height=3D"200" > > > dataProvider=3D"{initDG}" > > > horizontalScrollPolicy=3D"off"/> > > > > > > > > > > > > > > > -- > > > > > > Regards > > > Saju Thankathurai, > > > > --=20 Regards Saju Thankathurai, --001a11336a2e6ed48304fb5fe204--