Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8525961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:07:55+00:00 2026-06-11T08:07:55+00:00

I have an ArrayCollection filled with ‘o’ objects. This AC should be the dataProvider

  • 0

I have an ArrayCollection filled with ‘o’ objects. This AC should be the dataProvider of a DataGrid. After setting the dp: dgMT.dataProvider=acDataGrid the DataGrid contains only the last item of the arrayCollection.
Code:

[Bindable]
        public var acDataGrid:ArrayCollection = new ArrayCollection();
        protected function ddlLanguage_changeHandler(event:IndexChangeEvent):void{

            gcTranslate.headerText=Globals.acLanguages.getItemAt(ddlLanguage.selectedIndex,0).toString();
            Globals.acActValues=convertXmlToArrayCollection(File.applicationDirectory.resolvePath("xmls"+File.separator+Globals.acFileNames.getItemAt(ddlLanguage.selectedIndex,0)));

            Globals.acDataGrid.removeAll();
            var o:DataGridObject = new DataGridObject();
            var i:int=0;
            var angol:Object;
            for each(angol in Globals.acValues){
                o.en=angol.value;
                o.name=angol.name;

                if(i<Globals.acActValues.length && o.name==Globals.acActValues.getItemAt(i,0).name){
                    o.translation=Globals.acActValues.getItemAt(i,0).value;                 

                }
                else{
                    o.translation="";
                    Globals.acActValues.addItemAt("",i);
                }

                acDataGrid.addItemAt(o,i);

                trace("NAME: "+acDataGrid.getItemAt(i,0).name+" VAL:"+acDataGrid.getItemAt(i,0).en+"TRANS: "+acDataGrid.getItemAt(i,0).translation);
// the values are different!
                i++;
            }
            dgMT.dataProvider=acDataGrid;//setting the dataProvider         

        }

How could I reach that the DataGrid’s rows are filled with the correct values?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:07:57+00:00Added an answer on June 11, 2026 at 8:07 am

    You’re instantiating o just once, outside of the for loop. Which means your just changing the values of that instance’s properties and adding that same instance to the dataprovider over and over. You should instead create a new instance on every iteration.

    To fix this, simply move the instantiation of o inside the for loop:

    for each(angol in Globals.acValues){
        var o:DataGridObject = new DataGridObject();
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGrid, populated with objects in an ArrayCollection. After updating one of
I have an ArrayCollection of objects. I'm passing this array to a horizontallist as
I have this ArrayCollection filled with a xml data coming from and HttpService request.
I have a Datagrid with an ArrayCollection as DataProvider, the arrayCollection is partially generated
On one PC, I have a datagrid with dataprovider being an arraycollection populated by
I have a combobox with arrayCollection dataprovider, it has nothing selected after creation. I
I have an ArrayCollection which is a dataProvider to the DataGrid. The ArrayCollection may
I use this arrayCollection to populate a Flex 3 Datagrid. I'd also like to
I have following code. <s:DropDownList dataProvider={_dataProvider}/> <fx:Script> private var _dataProvider:ArrayCollection = new ArrayCollection([{label:one, data:1},
When the dataProvider for an DataGrid is an array of objects, how do I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.