3 Replies Latest reply on Nov 7, 2011 9:44 AM by Amy Blankenship

    Tree in AdvancedDatagrid with Data Object


      Hello everyone,



      I wnat to create a advanceddataGrid like a tree list.

      I have two ArrayCollection that I return from my backend and the idea is:


      ProposalVersion has a Proposal


      So, I wanna group all ProposalVersion in a Proposal:



                        Name                 |        Code     |   Description   |

      > Proposal 1                          |         P1        |                        |

               > ProposalVersion 1       |         P1.1     |                        |

               > ProposalVersion 2       |         P1.2     |                        |

      > Proposal 2                          |         P2        |                        |

               > ProposalVersion 3       |         P2.1     |                        |

               > ProposalVersion 4       |         P2.2     |                        |

               > ProposalVersion 5       |         P2.3     |                        |


      Can anyone give me some ideia?


      Thanks for atenption!

        • 1. Re: Tree in AdvancedDatagrid with Data Object
          Amy Blankenship Level 4

          Can you clarify? What is the relationship between your two ArrayCollections?  What have you tried, and what isn't working?

          • 2. Re: Tree in AdvancedDatagrid with Data Object
            Hadzel Level 1

            So, a ProposalVersion has one ProposaI_D, that is the foreign key!


            I tried this but dosen't worked:


            <mx: AdvancedDataGrid width:100%>

                   <mx: dataProvider>

                               <mx: HierarchicalData source="arrProposalVersion" childrenField="Proposal"/>

                   </mx: dataProvider>



                        <mx: AdvancedDataGridColumn datafield="ProjectName"/>

                        <mx: AdvancedDataGridColumn datafield="ProjectCode"/>

                        <mx: AdvancedDataGridColumn datafield="Description"/>


            </mx: AdvancedDataGrid>


            But from what I see, I need to use ArrayCollection or XML with a field 'children'.


            For example:



            private var dpHierarchy: ArrayCollection = new ArrayCollection ([

               {Region: "Southwest", children: [

                     {Territory_Rep: "Alice Treu", Actual: 44985, Estimate: 45000},

                     {Territory_Rep: "Jane Grove", Actual: 44913, Estimate: 45000}]}




            I tried with Groupping Collection to.


            <mx:AdvancedDataGrid width="100%">


                        <mx:GroupingCollection source="{arrProposal}">


                                <mx:GroupingField name="Proposal" />




                     <mx:GroupingField name="Proposal.Id" />


            But dosen't worked to. =(

            • 3. Re: Tree in AdvancedDatagrid with Data Object
              Amy Blankenship Level 4

              Your question still isn't providing enough pieces that I can put them together and figure out exactly what you're asking. I have an example here of how to use GroupingCollection http://flexdiary.blogspot.com/2008/09/groupingcollection-example-featuring.html . Maybe it can point you in the right direction.