Hi Tracy
That is similar to what I'm doing on my code at the bottom except my
arraycollection is in the destination grid and not the source, which
is how I wish to execute it, but how do I go about doing that? I only
want specific data to go to the destination grid, not all the data
that's in that index. Do you have any examples I could see to help me
better understand this?
-Sal
--- In [EMAIL PROTECTED]ups.com,
"Tracy Spratt"
<[EMAIL PROTECTED]> wrote:
>
> In general terms, build an ArrayCollection from the data you want to
> pass, and assign that ArrayCollection to the dataprovider property of
> the second grid.
>
>
>
> Tracy
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com]
On
> Behalf Of s_hernandez01
> Sent: Wednesday, August 09, 2006 9:43 AM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] passing data to a datagrid
>
>
>
> Hey Flexers,
>
> I am trying to send specific data from a datagrid to another datagrid
> and am having trouble with my actionscript. I can manage to send data
> if the index is selected, but I only want to send certain data to the
> other datagrid. Can anyone help? Here is what I have so far...
>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml>
"
> layout="absolute" xmlns="*" creationComplete="init()">
>
> <mx:Script>
> <![CDATA[
> import mx.collections.ArrayCollection;
> import mx.effects.*;
> import mx.core.*;
>
> public function init():void{
> srv.send();
> addEventListener("send",doSendEvent);
> }
>
> public function doSendEvent(event:Event):void{
> addToGrid(event.target.data);
> }
>
> public function addToGrid(product:Object):void{
> destGrid.addItem({cat: product.cat, upc: product.upc, description:
> product.description});
> }
> ]]>
> </mx:Script>
>
> <mx:HTTPService id="srv" url="">xml"
useProxy="false"
> result="(srv.lastResult.catalog.product)"/>
>
> <mx:HBox x="0" y="0" width="100%" height="100%"
> verticalAlign="middle" horizontalAlign="center">
>
> <mx:DataGrid dataProvider="{srv.lastResult.catalog.product}"
> id="srcGrid" itemClick="init()">
> <mx:columns>
> <mx:DataGridColumn headerText="UPC"
dataField="cat" width="60"/>
> <mx:DataGridColumn headerText="CAT NO."
dataField="upc" width="60"/>
> <mx:DataGridColumn headerText="DESCRIPTION"
dataField="description"
> width="300"/>
> <mx:DataGridColumn headerText="WEIGHT"
dataField="wgt" width="60"/>
> <mx:DataGridColumn headerText="BALANCE"
dataField="balance" width="60"/>
> </mx:columns>
> </mx:DataGrid>
>
> <DestGrid id="destGrid" width="50%"
height="20%"/>
>
> </mx:HBox>
> </mx:Application>
>
> <mx:DataGrid xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml>
"
> dataProvider="{myDP}">
>
> <mx:Script>
> <![CDATA[
> import mx.collections.ArrayCollection;
> import mx.effects.*;
> import mx.core.*;
>
> [Bindable]
> public var myDP:ArrayCollection = new ArrayCollection();
>
> public function addItem(item:Object):void{
> myDP.addItem(item);
> }
> ]]>
> </mx:Script>
> <mx:columns>
> <mx:DataGridColumn headerText="UPC"
dataField="cat" width="60"/>
> <mx:DataGridColumn headerText="CAT NO."
dataField="upc" width="60"/>
> <mx:DataGridColumn headerText="DESCRIPTION"
dataField="description"
> width="300"/>
> </mx:columns>
> </mx:DataGrid>
>