Close but not quite.  After looking at your code a little more 
closely, I see I was looking at the wrong datagrid.  You need to add 
a dataprovider to the selected_addons grid, and then add the item to 
that dataprovider.

Doug

--- In [email protected], "douglowder" <[EMAIL PROTECTED]> 
wrote:
>
> Hi Rich,
> 
> You want to add the item to the grid's dataprovider, not to the 
grid 
> object itself.  In your addRow() function, just change 
> selected_addons.addItem to addons.addItem and I believe that 
should 
> do it.
> 
> Doug
> 
> --- In [email protected], "Rich Kroll" <richard@> wrote:
> >
> > Hello All,
> > 
> > I currently have two datagrids, the top one is populated via an 
> XML file,
> > and lists all available inventory, an add button, then the 
second 
> datagrid
> > which will hold the items the user has selected from the first 
dg 
> and then
> > pressed the add button.  I'm having problems getting the 
selected 
> row from
> > the first dg to populate in the second.  I looked at the samples 
> provided
> > with flex2 and am trying to use the dg.addItem() method to add 
> items to the
> > second dg and having some problems.  Can anyone point me in a 
> direction on
> > how to accomplish this?  Here is my current code:
> > 
> >  
> > 
> > <mx:Script>
> > 
> >             <![CDATA[
> > 
> >                         import mx.collections.ArrayCollection;
> > 
> >                         
> > 
> >                         [Bindable]
> > 
> >                         public var addons:ArrayCollection;
> > 
> >                         
> > 
> >                         private function addRow():void {
> > 
> >                         selected_addons.addItem( 
{type: "Garage", 
> unit:
> > "1-101", price: "10,000"} );          
> > 
> >                         }
> > 
> >             
> > 
> >             ]]>
> > 
> >             
> > 
> > </mx:Script>
> > 
> >  
> > 
> >  
> > 
> > <mx:Canvas label="Tab 1" width="100%" height="100%">
> > 
> >             <mx:DataGrid x="41" y="40" width="550" 
> id="available_addons"
> > dataProvider="{addons}">
> > 
> >                         <mx:columns>
> > 
> >                                     <mx:DataGridColumn 
> headerText="Type"
> > columnName="type"/>
> > 
> >                                     <mx:DataGridColumn 
> headerText="Unit"
> > columnName="unit"/>
> > 
> >                                     <mx:DataGridColumn 
> headerText="Price"
> > columnName="price"/>
> > 
> >                         </mx:columns>
> > 
> >             </mx:DataGrid>
> > 
> >             <mx:Button x="541" y="204" label="Add" 
> buttonDown="addRow()"/>
> > 
> >  
> > 
> >             <mx:Label x="41" y="14" text="Available Add Ons"/>
> > 
> >             <mx:DataGrid x="41" y="248" width="550" 
> id="selected_addons">
> > 
> >                         <mx:columns>
> > 
> >                                     <mx:DataGridColumn 
> headerText="Type"
> > columnName="type"/>
> > 
> >                                     <mx:DataGridColumn 
> headerText="Unit"
> > columnName="unit"/>
> > 
> >                                     <mx:DataGridColumn 
> headerText="Price"
> > columnName="price"/>
> > 
> >                         </mx:columns>
> > 
> >             </mx:DataGrid>
> > 
> >             <mx:Label x="41" y="222" text="Selected Add Ons"/>
> > 
> >             <mx:Button x="518" y="398" label="Remove"/>
> > 
> > </mx:Canvas>
> > 
> >  
> > 
> > Rich Kroll
> > 
> > Application Developer
> > 
> >  
> > 
> > SITE Manageware, Inc.
> > 
> > 2841 W. Cypress Creek Rd.
> > 
> > Fort Lauderdale, FL 33309
> > 
> >  <mailto:Rich@> Rich@
> > 
> > 954-944-9020 x716
> >
>






--
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