Glad you got it working!

On Aug 26, 2017 10:34 PM, "Trevor Holman" <trev...@mchsi.com> wrote:

> Kyle, thank you... here's what I used to get it to work. Your code led me
> to some other reference on looping through the result array and I just used
> the private var as you mentioned.
>
>                 //handle result of getList function
>                 public function resultHandler(event:SQLEvent):void {
>                         var result:SQLResult = selectStmt.getResult();
>                         var temp:Array = result.data is Array ?
> result.data : [{rows:result.rowsAffected}];
>                         var listResult:ArrayCollection = new
> ArrayCollection(temp);
>                         _myResults.removeAll();
>                         _myResults.addAll(listResult);
>
>                 }
>
>
>
> -----Original Message-----
> From: Kyle McKnight [mailto:kamck...@gmail.com]
> Sent: Saturday, August 26, 2017 6:29 PM
> To: Flex Users Group
> Subject: Re: AIR
>
> private var _myResults:ArrayCollection = new ArrayCollection();
>
> private function resultsHandler(results:Object):void
> {
>     _myResults.removeAll();
>
>     for(loop through results) {
>         _myResults.addItem(result);
>     }
> }
>
> You would then only need to set the data provider one time in your other
> class, don't need to set it every single time the drop down changes.
>
>
> Kyle McKnight
> Senior UI Engineer - Accesso
> 602.515.1444 (M)
>
> On Sat, Aug 26, 2017 at 7:24 PM, Kyle McKnight <kamck...@gmail.com> wrote:
>
> > From the limited code you've posted what looks like is happeing is
> > that you are setting the data provider before you've created the
> > ArrayColleciton so you are setting it to null. Then in the results
> > handler you are creating a *new* ArrayCollection instead of editing
> > the one that you set as the data provider (not that you could edit it
> > anyway since it's null). This is why you aren't getting the results.
> > Then when you change the drop down, you are once again setting the
> > data provider, but this time you are setting it to the ArrayCollection
> > you previously created and then yet again creating a NEW one instead of
> editing the one that's in the data provider.
> >
> > In the data manager, declare your _myResults like this
> >
> > private var _myResults:ArrayCollection = new ArrayCollection();
> >
> > Then instead of creating a new one using the new operator, loop
> > through the results that come back and use addItem on _myResults.
> > (also making sure to call removeAll before doing so each time)
> >
> >
> > Kyle McKnight
> > Senior UI Engineer - Accesso
> > 602.515.1444 <(602)%20515-1444> (M)
> >
> > On Sat, Aug 26, 2017 at 7:20 PM, Trevor Holman <trev...@mchsi.com>
> wrote:
> >
> >> I've tried this in the resultHandler function and when I trace that
> >> variable _myResults I can see the [object Object], [object Object],
> >> [object Object] ArrayCollection... so it is pulling in the right
> >> info, I just can't figure out how to  get that to my
> >> Application.mxml. I've tried setting a property and then using a
> >> getter (from my original post) but like I mentioned it just pulls in
> the last change the dropdown displayed.
> >>
> >>  I know it's got to be something simple but I'm not even sure what to
> >> ask and it eludes me. I'm pretty green when it comes to this and I
> >> want to learn it. I can normally find what I need via google.
> >>
> >> -----Original Message-----
> >> From: Kyle McKnight [mailto:kamck...@gmail.com]
> >> Sent: Saturday, August 26, 2017 5:43 PM
> >> To: Flex Users Group
> >> Subject: Re: AIR
> >>
> >> Or just declare and define your _myresults variable at the same time.
> >>
> >> var _myResults:ArrayCollection = new ArrayCollection();
> >>
> >> Then instead of creating a new ArrayCollection when the results are
> >> returned, just run through the list of results in a loop and use the
> >> addItem method of the _myResults ArrayCollection to add each item to
> >> it
> >>
> >>
> >> Kyle McKnight
> >> Senior UI Engineer - Accesso
> >> 602.515.1444 (M)
> >>
> >> On Sat, Aug 26, 2017 at 6:40 PM, Kyle McKnight <kamck...@gmail.com>
> >> wrote:
> >>
> >> > There are many ways you could do it.
> >> >
> >> > Try dispatching a custom event, something like
> "itemCategoriesRecieved,"
> >> > from the data manager when the results are returned. In your class
> >> > that contains the data grid, listen for that event on your data
> >> > manager and set the data provider of the grid in the event handler.
> >> >
> >> >
> >> > Kyle McKnight
> >> > Senior UI Engineer - Accesso
> >> > 602.515.1444 <(602)%20515-1444> (M)
> >> >
> >> > On Sat, Aug 26, 2017 at 6:34 PM, Trevor Holman <trev...@mchsi.com>
> >> wrote:
> >> >
> >> >> This is what I'm trying to do but I'm not sure how to do this so
> >> >> that the variable is set before I set the dataProvider...
> >> >>
> >> >> -----Original Message-----
> >> >> From: Kyle McKnight [mailto:kamck...@gmail.com]
> >> >> Sent: Saturday, August 26, 2017 11:38 AM
> >> >> To: Flex Users Group
> >> >> Subject: Re: AIR
> >> >>
> >> >> Or you can also just make sure to set it as the data provider
> >> >> after the results are received rather than before.
> >> >>
> >> >> Kyle
> >> >>
> >> >>
> >> >> Kyle McKnight
> >> >> Senior UI Engineer - Accesso
> >> >> 602.515.1444 (M)
> >> >>
> >> >> On Sat, Aug 26, 2017 at 12:35 PM, Kyle McKnight
> >> >> <kamck...@gmail.com>
> >> >> wrote:
> >> >>
> >> >> > Don't set _myResults to a brand new ArrayCollection.
> >> >> >
> >> >> > 1. Instead, insure _myResults exists (maybe create an empty one
> >> >> > when you instantiate your DataManager).
> >> >> > 2. Set _myResults as  the data provider on your DataGrid.
> >> >> > 3. When you get your results, use the addItem method on
> >> >> > _myResults to add the items.
> >> >> >
> >> >> > Kyle
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > Kyle McKnight
> >> >> > Senior UI Engineer - Accesso
> >> >> > 602.515.1444 <(602)%20515-1444> (M)
> >> >> >
> >> >> > 2017-08-26 12:23 GMT-04:00 <vinc...@after24.net>:
> >> >> >
> >> >> >> Bonjour,
> >> >> >>
> >> >> >> En congés jusqu'au 4 septembre, je prendrais connaissance de
> >> >> >> votre message à mon retour.
> >> >> >>
> >> >> >> Cordialement,
> >> >> >>
> >> >> >> Vincent/AFTER24
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >
> >>
> >>
> >
>
>

Reply via email to