function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ekmekm 

Flex - Post data from datagrid into table

Hi,

I can create a new record from 2 text fields using the following:

private function createContactManager():void
    {

        var contact:SObject = new SObject('Contact');  
      
        contact.FirstName = firstName.text;  //firstname text field
        contact.LastName = lastName.text; // lastname text field

        apex.create([contact],
            new AsyncResponder( function (result:Object):void
            {
                
                }, genericFault
                            )
                        )
        }

But what about when I have contacts from a datagrid and I want to create new records for each contact within the datragid.
For instance, if I was using the following:
datagrid="dgContacts"
dataprovider="contactList"
arraycollection = acMyContacts

I'd appreciate any help provided or even if someone could point me to an example of this or where it's referred in the documentation. I have so far been unable to find anything.

Thanks.
ekmekm
I think I may have finally figured it out. Created a for loop and then used the following within the loop:

contact.FirstName = contactInternalList.getItemAt(j).FirstName;

contactInternalList is the dataprovider in the datagrid I'm pulling the data from.
All the FirstName(s) in my dataprovider then get created in the Contact table.
On to the next challenge which I'm sure will come up shortly! ;)