First I think you're confused about the semantics of 
ArrayCollection... it is not a collection of arrays, but rather a 
Collection interface wrapper on a single array.

When you define the dataProvider statically in mxml the way you did, 
what you're doing is creating a single array of Objects (each object 
having 3 properties)

So you want to do the same thing with the ArrayCollection in code...

var dp:ArrayCollection = new ArrayCollection();

var o:Object = new Object();
o.Poll="Do You Like Law And Order";
o.Number="53";
o.owner="batanga/jumpman"
o.type="1";

dp.addItem(o);

dgFeatured1.dataProvider = dp;


GoodLuck!
PW

--- In [email protected], {reduxdj} <[EMAIL PROTECTED]> wrote:
>
> Good morning,
> 
> Sorry, to post this again, but I'm goin in circles and confused 
how to 
> populate a datagrid properly with an array collection as a 
> dataProvider.  I'm able to use an mx:ArrayCollection or a single 
array 
> in an array collection, but how do I populate it automatically 
with an 
> array collection holding 3 arrays, like this?
> 
> <mx:DataGrid id="dgFeatured1" width="250" height="150" 
> styleName="mainText" top="208" left="46" itemClick="itemClickEvent
(event);">
>            
>             <mx:ArrayCollection>
>             <mx:source>
>                   <mx:Object Poll="Do You Like Law And Order" 
> Number="53" owner="batanga/jumpman" type="1"/>
>                   <mx:Object Poll="When Do You Do Most Of Your 
> Christmas..." Number="49" owner="batanga/jumpman" type="1"/>
>                   <mx:Object Poll="Can I Date Your Daughter" 
Number="54" 
> owner="batanga/DonaldRumsfeld" type="1"/>
>                  
>                 </mx:source>
>                  </mx:ArrayCollection>
>             <mx:columns>
> 
> This works, but I want to do the same thing as above with my 
arrays in 
> an array collection, this probably something really basic I don't 
grasp 
> how to use.  This works, but only with one array in my array 
collection...
> 
> var _data_fastest:Object = RemotingProvider.getInstance().getPolls
();
>             fastestAC = new ArrayCollection(_data_fastest.fastest);
> 
> 
> I want to the following, why does this not work the same way, what 
am I 
> not grasping:
> 
> fastestAC = new ArrayCollection
(_data_fastest.fastest,_data_.id,_data.type);
> 
> then I want to use the dataProvider so I can populate it just like 
the 
> first example and then get my selected item.
> 
> Thanks flex genius!
>


Reply via email to