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";
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="data/catalog.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";
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>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to