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