4 Replies Latest reply on Aug 16, 2007 2:20 PM by GeorgeWS

    Send Data

    187_2007 Level 1
      I have a datagrid with Data in it named StructData. Below that I have a button. Hen I click the button I want to send the data in the grid to my function. What is the correct syntex to grab the grid data and send it to my function?

      Here is my Grid... Look at the button below the grid. Am I sending the Grid object correctly?


      <mx:DataGrid id="StructGrid" dataProvider="{ArrayofStructs}" x="322" y="293" editable="true" itemEditEnd="processData1(event);">
      <mx:columns>
      <mx:DataGridColumn headerText="Name" dataField="NAME" />
      <mx:DataGridColumn headerText="Last Name" dataField="LASTNAME" />
      <mx:DataGridColumn headerText="Age" dataField="AGE" />
      <mx:DataGridColumn headerText="Sex" dataField="SEX" itemEditor="valueObjects.HumanSex" sortable="false">
      <mx:itemRenderer>
      <mx:Component>
      <mx:Text selectable="false" width="100%" text="{data.SEX}"/>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      </mx:columns>
      </mx:DataGrid>
      <mx:Button x="322" y="443" label="Button" click="SendDatainGrid(StructGrid.data)" />
        • 1. Re: Send Data
          ntsiii Level 3
          Try:
          outerDocument.SendDatainGrid(data)

          Tracy
          • 2. Re: Send Data
            187_2007 Level 1
            I get this.


            2 1120: Access of undefined property outerDocument. FlexToCFC.mxml FlexToCFC line 201 January
            • 3. Re: Send Data
              187_2007 Level 1
              Finally figued it out. First off. For those that read this thread. Here is a great example

              http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=568

              This is my DataGrid:

              <mx:DataGrid id="StructGrid" dataProvider="{ArrayofStructs}" x="322" y="293" editable="true" itemEditEnd="processData1(event);">
              <mx:columns>
              <mx:DataGridColumn headerText="Name" dataField="NAME" />
              <mx:DataGridColumn headerText="Last Name" dataField="LASTNAME" />
              <mx:DataGridColumn headerText="Age" dataField="AGE" />
              <mx:DataGridColumn headerText="Sex" dataField="SEX" itemEditor="valueObjects.HumanSex" sortable="false">
              <mx:itemRenderer>
              <mx:Component>
              <mx:Text selectable="false" width="100%" text="{data.SEX}"/>
              </mx:Component>
              </mx:itemRenderer>
              </mx:DataGridColumn>
              </mx:columns>
              </mx:DataGrid>
              <mx:Button x="322" y="443" label="Button" click="SendDatainGrid()" />


              This is my Function:

              //Receive Data From a Grid
              public function SendDatainGrid():void{
              callSendGridData.AcceptGridData(ArrayofStructs); //Send Data To CFC
              //trace(ArrayofStructs[0].NAME);
              Alert.show("Data Sent and saved");
              }




              As you can see I actually send the Array to a CFC. But my TRACE which is commented out will return the correct "updated" field. So it works great now.. Yeaaaa Me!!!
              • 4. Re: Send Data
                GeorgeWS Level 1
                I like what I see! Can you show me your CFC?

                Thanks
                George