I just found an example of a hardcoded array that does what I want:

private var masterData:Array = [
                        { OrderId: 10248, CustomerId:"WILMK", EmployeeId:5, 
OrderDate:"1-Feb-2007", 
                children:[
                                    [
                                        {ProductId:11, ProductName:"Quesbo 
Cabrales", UnitPrice:14, Quantity:12, Discount:0, Price:168},
                                        {ProductId:42, ProductName:"Singaporean 
Hokkien Fried Mee", UnitPrice:9.8, Quantity:10, Discount:0, Price:98},
                                        {ProductId:42, ProductName:"Mozzarella 
di Giovanni", UnitPrice:34.8, Quantity:5, Discount:0, Price:174}
                                    ]
                                        ]}
                             ]
                         ]}

this is form this blog: 
http://techrays.wordpress.com/2008/04/07/advanced-datagrid-as-an-item-renderer-within-an-advanced-datagrid/#comment-1511

When I debug my collection (recalls is the arraycollection i use) as it is 
returned from the server I am seeing something like this:

recalls[0] - RecallRecord object
- prop
- prop
- groupedTrades - ArrayCollection that I want to use as DP for renderProvider
groupedTrades[0] - Generic Object
groupedTrades[1] - Generic object

I fail to see the difference between the hardcoded version from the blog that 
works and the data I'm using from my service. What am I missing? 

thank you!


--- In flexcoders@yahoogroups.com, "Matthew" <fumeng5@...> wrote:
>
> Hi - 
> 
> I'm having a problem with an AdvancedDataGrid that has a DataGrid as a 
> renderProvider. My dataProvider for the ADG is an ArrayCollection of the 
> below object. 
> 
> [Bindable]
> public class MyRecord implements ValueObject
> {
> 
>     public var recall_id:int;
>     public var recall_type:String;
>     public var selected:Boolean = false;
>     public var qty:Number;
>     public var curr_qty:Number;
>     public var due_date:String;
>     public var status:String;
>     public var comments:String;
>     public var groupedTrades:ArrayCollection = new ArrayCollection();
> }
> 
> <mx:dataProvider>       
> 
>      <mx:HierarchicalData 
>       source="{model.recalls}"
>       childrenField="groupedTrades"/>      
> 
> </mx:dataProvider>
> 
> Here's my renderProvider code:
> 
> <mx:rendererProviders>
> 
> <mx:AdvancedDataGridRendererProvider 
>     depth="2" 
>     columnIndex="1" 
>      renderer="com.controls.GroupedTradesGrid"
>       columnSpan="0"/>
> </mx:rendererProviders> 
> 
> In this GroupedTradesGrid I override this method to set the dataProvider:
> 
> override public function set data(value:Object):void
>         {
>             // If using the array data source, use this instead:
>             trades_dg.dataProvider = value;
>         }
> 
> The problem is that my renderProvider's method is invoked for every record in 
> the dataProvider of the ADG it is part of. This amounts to a brand new 
> DataGrid for each trade in groupedTrades...instead of 1 DataGrid that has all 
> trades. 
> 
> I'm very frustrated as I've asked around on other forums and can't seem to 
> get a response. Anyone have any ideas? I'm kind of at my wits end. 
> 
> Thank you for any helpful tipsF!
> 
> How do I resolve this? I'm perplexed.
>


Reply via email to