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

[EMAIL PROTECTED]

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




Reply via email to