Apache flex 对象到arraycollection,然后再到datagrid

Apache flex 对象到arraycollection,然后再到datagrid,apache-flex,actionscript,Apache Flex,Actionscript,比如说,linedataColl是一个AC,包含200多行从CSV提取的数据,在我的设计中,我希望逐个对象将项目添加到SuperDataCollection中,但唯一的问题是我无法在S中看到任何数据显示,这是一个数据网格。我的代码怎么了 var superDataCollection:ArrayCollection = new ArrayCollection(); var dc:ArrayCollection = new ArrayCollection()

比如说,linedataColl是一个AC,包含200多行从CSV提取的数据,在我的设计中,我希望逐个对象将项目添加到SuperDataCollection中,但唯一的问题是我无法在S中看到任何数据显示,这是一个数据网格。我的代码怎么了

var superDataCollection:ArrayCollection = new ArrayCollection();
                    var dc:ArrayCollection = new ArrayCollection();
                    var di:Object = new Object();
                    for(var aa:int=0; aa<5;aa++){
                        di.username = linedataColl[aa].username;
                        di.email = linedataColl[aa].email;
                        dc.addItem(di);
                        superDataCollection.addItem(dc);
                        s.dataProvider = dc;
                    }

不要在for循环中设置数据提供程序。您只需设置一次,datagrid将检测到您指定为dataProvider的ArrayCollection的更改

最好的做法是在完全构建ArrayCollection“dc”之后设置它

也许你的问题会通过这个解决

                }
                s.dataProvider = dc;

请添加如何配置DataGrid的代码。