I got it to work with the hard coded data.  However, I cannot seem to pass an array in my initObj correctly.  Do I need another loop for my array or is there somthing else I am not seeing?

Thanks,

*******************
Main component
*****************

public var selectedTeamMembers:Array;
 
public function addMember(){
   var teamMemberObj = new Object();
   var selectedIndices:Array = new Array(dgTeamMemberName.length);
  
//loop through and pull all names in the datagrid
 for(var i=0; i < dgTeamMemberName.length; i++) {
 selectedIndices[i] = i;
 }
 dgTeamMemberName.selectedIndices = selectedIndices;
 for(var j=0; j < dgTeamMemberName.selectedIndices.length; j++){
      selectedTeamMembers = dgTeamMemberName.selectedItems[j].name;   //this array does not pass anything
}
// Create a new pop-up with and add all team members to pop-up datagrid
 
 var popup:Object  = mx.managers.PopUpManager.createPopUp(_root, comp.popUpBox, true, {teamMemberObj: selectedTeamMembers});
popup.addEventListener('teamMemberObject', this);
}


--- In [email protected], "Doug Lowder" <[EMAIL PROTECTED]> wrote:
>
> Hi Ryan,
>
> Define a variable in your popup component that you bind to the
> grid's dataprovider:
>
> var teamMemberData: Array;
> ...
> <mx:DataGrid id="dgTeamMemberAssignment2" width="100%"
> dataProvider="{teamMemberData}">
>
> Then, in your main component, pass the data for your popup's grid as
> the initObj. You can use this as a test:
>
> mx.managers.PopUpManager.createPopUp(_root, comp.popUpBox, true,
> { teamMemberData: [ {name: "A"}, {name: "B"}, {name: "C"} ] });
>
> From there, once you get that working, just create a new array
> containing the selected items from your main component's grid and
> pass that array rather than the dummy data. The initObj should look
> something like:
>
> { teamMemberData: mySelectedItemsArray }
>
>
> Hope that helps,
> Doug
>
> --- In [email protected], "rgwilson26" ryan.wilson@
> wrote:
> >
> > I am working on an app (Flex 1.5) that passes data from the main
> > apps dataGrid and sends it to a popUp with another dataGrid. I
> have
> > some logic that will select all the data in the main apps datagrid
> > and send it to the popUp, but it only sends the last value in my
> > main apps dataGrid..
> >
> > Does anyone have any suggestions of how to send all the values of
> my
> > main apps data grid to the popUps datagrid? I want the user to be
> > able to open the pop up with all the main app datagrid values so
> > they can add or delete them within the pop-up.
> >
> > Below is some sample code.
> >
> > Thanks,
> >
> >
> > **************************
> > Main component
> > ***************************
> > <mx:Script>
> > <![CDATA[
> >
> > public var selectedTeamMembers:String;
> >
> > public function addMember(){
> > var teamMemberObj = new Object();
> > var selectedIndices:Array = new Array
> > (dgTeamMemberName.length);
> >
> > //loop through and pull all names in the datagrid
> > for(var i=0; i < dgTeamMemberName.length; i++) {
> > selectedIndices[i] = i;
> > }
> > dgTeamMemberName.selectedIndices = selectedIndices;
> > for(var j=0; j <
> > dgTeamMemberName.selectedIndices.length; j++){
> > teamMemberObj.selectedTeamMembers =
> > dgTeamMemberName.selectedItems[j].name;
> > }
> > // Create a new pop-up with and add all team members
> > to pop-up datagrid
> > var popup:Object =
> > mx.managers.PopUpManager.createPopUp(_root, comp.popUpBox, true,
> > teamMemberObj);
> > popup.addEventListener('teamMemberObject', this);
> > }
> >
> >
> > ]]>
> > </mx:Script>
> >
> >
> >
> > <mx:DataGrid id="dgTeamMemberName">
> > <mx:columns>
> > <mx:Array>
> > <mx:DataGridColumn headerText="Name" columnName="name"/>
> > </mx:Array>
> > </mx:columns>
> > </mx:DataGrid>
> >
> > <mx:Button label="Add Team Member" click="addMember()"/>
> >
> > **************************
> > popUp component
> > ***************************
> > <mx:Script>
> > <![CDATA[
> >
> > private function initPopUp(){
> > if(selectedTeamMembers != ""){
> > dgTeamMemberAssignment2.addItem({name:
> > selectedTeamMembers});
> > }
> > }
> >
> >
> > ]]>
> > </mx:Script>
> >
> >
> > <mx:DataGrid id="dgTeamMemberAssignment2" width="100%">
> > <mx:columns>
> > <mx:Array>
> > <mx:DataGridColumn headerText="Team Member(s)
> > assignment" columnName="name" />
> > </mx:Array>
> > </mx:columns>
> > </mx:DataGrid>
> >
>



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




Reply via email to