Thanks that worked beautifully my final code follows:

        private function dgClick():void {
           var curTick:String = dgOrdExt.selectedItem.Ticker;
           for (var i:int = 0; i < Array_Exits.length; i++)
              {
                if ( Exits(Array_Exits.getItemAt(i).Ticker ==c urTick)
                {
                   dgExits.selectedIndex = i;
                }
              }
           }



--- In flexcoders@yahoogroups.com, "Tim Hoff" <timh...@...> wrote:
>
> 
> Going to have to loop:
> 
> var curTick:String = dg1.selectedItem.Ticker;
> 
> for (var i:int = 0; i < dg2.dataProvider.length; i++)
> {
>      if ( Object(dg2.dataProvider.getItemAt(i)).Ticker == curTick )
>      {
>           dg2.selectedIndex = i;
>      }
> }
> 
> Depending on your model, you could use for each instead.  Also, replace
> dg2.dataProivider with the appropriate ArrayCollection name and replace
> Object with your VO class name; if you're using one.  I'd use the
> "change" event instead of "click".
> 
> -TH
> 
> --- In flexcoders@yahoogroups.com, "Craig" <craigj@> wrote:
> >
> >
> > Take 3... after further review, to simplify things I have bound 2
> > separate ArrayCollection to separate DataGrids they both share one
> > common field - Ticker.. I'd like to select the corresponding row
> > programmatically in the second datagrid which contains the value for
> > 'Ticker' that is selected in the first datagrid.
> >
> > So far this does not work...
> >
> > <mx:DataGrid id=dg1 click='onClick()" />
> >
> > <mx:DataGrid id=dg2 />
> >
> > private function onClick(): void {
> >
> > var curTick:String = dg1.selectedItem.Ticker;
> >
> > dg2.selectedItem.Ticker = curTick;
> >
> > dg2.selectedIndex= dg2.selectedItem.Ticker.rowindex;
> >
> > }
> >
> > Any suggestions?... Anyone??
> >
> > I imagine the ListCollection will work but not sure the syntax.
> >
> >
> >
> >
> >
> >
> >
> >
> > --- In flexcoders@yahoogroups.com, "Craig" craigj@ wrote:
> > >
> > > Actually after thinking about it, I should just add the 2nd
> Webservice
> > > result to the first ArrayCollection data model. They both share the
> > > same field 'Ticker' but have different fields thereafter. The first
> > > result is Array_OrdExt and the second is Arrray_Exits.
> > > The Array Build routines for both are below.
> > >
> > > [Bindable] public var Array_Exits:ArrayCollection;
> > > public function Exits_Result(e:ResultEvent):void {
> > > Array_Exits = e.result as ArrayCollection;
> > > for (var i:int=0;i<Array_Exits.length;i++)
> > > {
> > > var Current_exit:Exits = new Exits();
> > > Current_exit = new
> > > Exits(Array_Exits.getItemAt(i));
> > > Array_Exits.setItemAt(Current_exit, i);
> > > }
> > > }
> > >
> > > [Bindable] public var Array_OrdExt:ArrayCollection;
> > > private function OrdExt_result(e:ResultEvent):void {
> > > Array_OrdExt = e.result as ArrayCollection;
> > > for (var i:int=0;i<Array_OrdExt.length;i++)
> > > {
> > > var Current_ordext:OrdExt = new OrdExt();
> > > Current_ordext = new
> > > OrdExt(Array_OrdExt.getItemAt(i));
> > > Array_OrdExt.setItemAt(Current_ordext, i);
> > > }
> > > }
> > >
> > > These build from two WebsServices results WSDL format (XML). For the
> > > second one, which is Array_Exits... can I just add it to the first
> one
> > > with the same result event? I would like to use the first field of
> > each
> > > collection 'Ticker' as the WHERE Ticker=Ticker then do the Get and
> > > Set...
> > >
> > > The Data Model for each Array is OrdExt.as and Exits.as is
> structured
> > as
> > > follows:
> > >
> > > package DTO.OrdEnt
> > > {
> > > [Bindable]
> > > public class OrdEnt
> > > {
> > > public var Ticker:String = "";
> > > public var Company:String = "";..........continues
> > >
> > > public function OrdEnt(obj:Object=null){
> > > if (obj!=null){
> > > this.Ticker=obj.Ticker;
> > > this.Company=obj.Company;..............continues
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In flexcoders@yahoogroups.com, "Craig" craigj@ wrote:
> > > >
> > > > I need to create a DataModel.as that will synchronize two
> > > > arraycollections and allow me to update a Form based on the
> contents
> > > of
> > > > the 2nd arraycollection.index.item(s) when the first
> arraycollection
> > > > selecteditem is clicked as the dataprovider for a datagrid.
> > > >
> > > >
> > > > The 2 arraycollections are populated via webservices from sql
> > > database,
> > > > (which I can not InnerJoin from 4 different tables due to
> > > > performance)... so I end with two separate arraycollections:
> > > >
> > > > One populates a Datagrid, the other is just resident in an
> > > > ArrayCollection: Here is some of the sample code:
> > > >
> > > > <mx:columns>
> > > > <mx:DataGridColumn dataField="Ticker"
> > > > headerText="Ticker"/>
> > > > <positions:KindColumn id="Kind"
> > > > headerText="Kind"
> > > > dataField="Kind"
> > > > itemRenderer="com.steury.baseClasses.CellFieldTrd"/>
> > > > <mx:DataGridColumn id="EnterPrice"
> > > > labelFunction="{myPrice}"
> > > > dataField="EnterPrice"
> > > > headerText="EnterPrice"/>
> > > > <mx:DataGridColumn id="ClosePrice"
> > > > labelFunction="{myClosePr}"
> > > > dataField="Close"
> > > > headerText="Price"/>
> > > > <positions:ProfitColumn id="Profit"
> > > > headerText="Profit"
> > > > dataField="Profit"
> > > > labelFunction="{perCent}"
> > > > itemRenderer="com.steury.baseClasses.CellFieldInt"/>
> > > > </mx:columns>
> > > >
> > > > ______________________________________________
> > > >
> > > > <positions:DgOrdExt id="dgOrdExt"
> > > > width="100%" height="50%"
> > > > textAlign="center"
> > > > dataProvider="{Array_OrdExt}"
> > > > itemClick="onTick4()" >
> > > >
> > > > One Array is Array_OrdEx and the other Array is Array_Exits.
> > > >
> > > > When I select an item on the dgOrdExt DataGrid, I simply want to
> > > > populate the text values of a Form with the appropriate Items in
> the
> > > > second datagrid... Here is the trick... they both share the same
> > > > 'Ticker' value, but just different other variables... so it's not
> > too
> > > > difficult, it's just trickier than my novice programming skills
> can
> > > > handle - easily.
> > > >
> > > > [Bindable] public var ExtTicker:String;
> > > >
> > > > So the OnTick4() event will contain the following code:
> > > >
> > > > ExtTicker=dgOrdExt.selectedItem.Ticker;
> > > >
> > > > Then I need to somehow update the form as follows:
> > > > formOrdExt.tiHigh.text=dgOrdExt.selectedItem.High;
> > > > formOrdExt.tiLow.text=dgOrdExt.selectedItem.Low
> > > >
> > > >
> > >
> >
> formOrdExt.tiStrategy.text=Array_Exists.getItemAt({ExtTicker}).Strategy;
> > > >
> > > > Or I need to build an DataModel.as class to sychronize the two
> > > > arraycollections... I have thought about using source.concat but
> > that
> > > > will append the two collections and I will have 2 of every Ticker,
> > > where
> > > > I only want 1 of every Ticker with the appropriate value (Open,
> > High,
> > > > Low, SellPrice, Profit, BudyDate, Exit, Strategy, etc).
> > > >
> > > > Can someone give me a hand?
> > > > CS
> > > >
> > >
> >
>


Reply via email to