So close... No errors, but the second datagrid is empty. I'm not
getting any errors on the FaultEvent and I know the data is there.
Think I'm missing something really small.


                public function onSelectFirstGrid(event:Event):void

                {
                        myRequest.addEventListener('result', onResult)
                        myRequest.send(dg.selectedItem.orgID);
                }

                
                private function onResult(event:ResultEvent):void

                {
                        dg2data = event.result as ArrayCollection;
                }
                
                private function onFault(event:FaultEvent):void

        {
            Alert.show(event.fault.message, "Could not load");
        }

                [Bindable]

                public var dg2data: ArrayCollection;


Looks good.. and my HTTPService...


        <mx:HTTPService id="myRequest"  
                                        
url="http://localhost:3000/organizations/flex_programs";
                                        showBusyCursor="true"
                                        result="onResult(event)"
                                        fault="onFault(event)"
                                        useProxy="false"/>

I did try a datagrid, but came up empty so I'm trying a list:

<mx:List id="mylist" dataProvider="{dg2data}" labelField="name" />



Thanks again!






--- In [email protected], "Brian Holmes" <[EMAIL PROTECTED]>
wrote:
>
> yep, you're on the right track.
> 
>  
> 
> don't populate the second grid directly. populate an array collection or
> xml list collection object and bind the data provider of the grid to
> your variable. 
> 
>  
> 
>  
> 
> set an on result method on your httpRequest call and when it comes back
> you can populate your bindable data var
> 
>  
> 
> something like, but you might wanna look at examples, I'm sure there are
> a ton if you look on the internet, and also check out Adobe Flex Quick
> Starts
> 
>  
> 
>  
> 
>  
> 
>  
> 
> public function onSelectFirstGrid():void
> 
> {
> 
>     httpRequest.addEventListener(result, onResult)
> 
>     httpRequest.send(dg1.selectedItem.ID);
> 
>  
> 
> }
> 
>  
> 
> private function onResult(event:ResultEvent):void
> 
> {
> 
>             dg2data = new ArrayCollection();
> 
> }
> 
>  
> 
> [Bindable]
> 
> public var dg2data: ArrayCollection = new ArrayCollection()
> 
>  
> 
>  
> 
>  
> 
> <mx:DataGrid dataProvider={secondGridData}" />
> 
>  
> 
>  
> 
>  
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of its_llpj
> Sent: Wednesday, September 05, 2007 2:55 PM
> To: [email protected]
> Subject: [flexcoders] Re: Grabbing ID from one datagrid to populate a
> second.
> 
>  
> 
> Thanks Brian,
> 
> Cool stuff... So if I wanted to pass the ID I would have an itemClick
> on the first datagrid that calls an event:
> itemClick="showSelectedItems(event)"
> 
> And then in the mx:Script I can send the id to the new mx:HTTPRequest:
> myRequest.send(dg.selectedItem.myID)
> 
> I guess my question is how do I populate the results back to the
> second datagrid?
> 
> Thanks again!
> 
> --- In [email protected] <mailto:flexcoders%40yahoogroups.com>
> , "Brian Holmes" <Brian.Holmes@>
> wrote:
> >
> > 
> > 
> > 
> > 
> > look into the data grid selected item property. You should be able to
> > reference the currently seleted row and depending how you have your
> > data reference the ID
> > 
> > 
> > 
> > 
> > 
> > something like
> > 
> > 
> > 
> > myDataGrid.selectedItem.ID
> > 
> > 
> > 
> > or myDataGrid.selectedItem["ID"]
> > 
> > 
> > 
> > 
> > 
> > brian..
> > 
> > 
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected] <mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of its_llpj
> > Sent: Wednesday, September 05, 2007 1:23 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Grabbing ID from one datagrid to populate a
> > second.
> > 
> > 
> > 
> > Newbie question, but how do I get the id from the current element in a
> > datagrid and then pass the ID via mx:HTTPService to populate a second
> > datagrid?
> > 
> > Thanks!
> > 
> > 
> > 
> > 
> > 
> > ***
> > The information in this e-mail is confidential and intended solely
> for the individual or entity to whom it is addressed. If you have
> received this e-mail in error please notify the sender by return
> e-mail delete this e-mail and refrain from any disclosure or action
> based on the information.
> > ***
> >
> 
>  
> 
> 
> 
> ***
> The information in this e-mail is confidential and intended solely
for the individual or entity to whom it is addressed.  If you have
received this e-mail in error please notify the sender by return
e-mail delete this e-mail and refrain from any disclosure or action
based on the information.
> ***
>


Reply via email to