LOL! thanx anyhoo, Doug.

I can guess that all I need to do is get a reference to the origional
ArrayCollection (the dataGrid's dataProvider) from within the
titleWindow and let the [binding] do the rest... but it's a read then
append then save.

I've tried but keep getting scoping issues.... from the titleWindow's
point of view the ArrayCollection is in the parent's parent. 

my code (so far) for the itemRenderer and titleWindow are in my
origional post but I'll throw it in here (in desperation)

(cheers, mate)

anyone else suggest how to do this?

much appreciated
thanx
barry.b


*************
itemRenderer (parent)
*************

<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml";>
       <mx:Script>
       <![CDATA[
               import mx.controls.DataGrid;
               import mx.events.FlexEvent;

               import mx.managers.PopUpManager;
               import mx.core.IFlexDisplayObject;
               import mx.containers.TitleWindow;

               private function showSearch():void {
                       var searchWindow:TitleWindow =
                       TitleWindow(PopUpManager.createPopUp(this
                               , AcademicSearchForm, true));
                       searchWindow.title="Enter Academic Surname";
                       searchWindow.showCloseButton=true;
               }

               [Bindable]
               public var newAcademic:String = new String();
       ]]>
       </mx:Script>
       <mx:TextInput id="AcademicText" text="{newAcademic}" />
       <mx:Button id="SearchAcademicBtn" label="Look-up"
click="showSearch();" />
</mx:HBox>


***************
modal search window (titleWindow)
***************

<?xml version="1.0"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
       creationComplete="doInit();"
       showCloseButton="true"
       close="removeMe()"
>
       <mx:Script>
       <![CDATA[
       import mx.managers.PopUpManager;

       private var AcademicSearchResults:Array = new Array(
               {surname: null, firstname: null, loginName: null}
       );


       private function removeMe():void {
           // Put any clean-up code here.
           PopUpManager.removePopUp(this);
       }

       private function doInit():void {
           PopUpManager.centerPopUp(this);
           SearchResultsDG.visible = false;
       }

       private function processSearch():void {
               // show "waiting" indicator...
               clearSearchResults();
               getSearchResults();
               SearchResultsDG.visible = true;
               SearchResultsDG.dataProvider = AcademicSearchResults;

       }
       private function getSearchResults():void{
               // REPLACE THIS WITH REMOTE CALLS
               AcademicSearchResults = new Array(
                       {surname: 'aaa', firstname: 'bbb', loginName:
'aaab'}
                       , {surname: 'ccc', firstname: 'ddd', loginName:
'cccd'}
                       , {surname: 'eee', firstname: 'fff', loginName:
'eeef'}
               );

       }

       private function clearSearchResults():void{
               AcademicSearchResults = new Array(
                       {surname: null, firstname: null, loginName: null}
               );
                SearchResultsDG.visible = false;
       }
       private function finaliseResults():void{
               /* HERE:
               take what was selected with "useChoice" checkboxes and
               _append_ the loginName fields as a list back to the
               parent itemRenderer control
               */
               removeMe();
       }

       ]]>
   </mx:Script>
   <mx:Form>
       <mx:FormItem label="Surname">
           <mx:TextInput id="surname" width="100%"/>
       </mx:FormItem>
   </mx:Form>
   <mx:VBox>
       <mx:HBox>
           <mx:Button click="processSearch();" label="Search"/>
           <mx:Button click="finaliseResults()" label="Done"/>
           </mx:HBox>
           <mx:DataGrid id="SearchResultsDG">
               <mx:columns>
                   <mx:DataGridColumn headerText="surname"
dataField="surname"/>
                   <mx:DataGridColumn headerText="firstname"
dataField="firstname"/>
                   <mx:DataGridColumn headerText="loginName"
dataField="loginName"/>

                   <mx:DataGridColumn headerText="Use">
                       <mx:itemRenderer>
                       <mx:Component>
                               <mx:HBox horizontalAlign="center">
                                       <mx:Script>
                                       <![CDATA[
                                               [Bindable]
                                               public var
selected:Boolean;
                                       ]]>
                                       </mx:Script>

                                       <mx:CheckBox id="useChoice"
selected="false" click="selected =
useChoice.selected"/>

                               </mx:HBox>
                       </mx:Component>
                       </mx:itemRenderer>
                   </mx:DataGridColumn>

               </mx:columns>
           </mx:DataGrid>

     </mx:VBox>
</mx:TitleWindow>
****************************************





--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to