3 Replies Latest reply on Jan 5, 2010 10:25 AM by asaad970

    Tree Or AdvancedDataGrid

    asaad970 Level 1

      Hello,

       

          I have an ArrayCollection (accounts) as a result of calling getallaccounts service call witch contains the data of the

      table chartofAccounts witch  fields :

      (

      acc_number,

      acc_level,

      acc_name,

      main_acc_no

      )

      and so on ..

      for each account there is a parent account except the top level accounts witch is level 1 its parent accounts is its own

      so i need to present that hierarchical data in the advancedDataGrid , starting from level 1 then for each account in level one

      comes the child accounts in level 2 and for each account in level 2 comes the child account in level 3 and so on ..

       

      the data should appear like that

       

      1 assets

                  101 fixd assets

                                   10101 lands

                                   10102  buildings

                                               10101001 buiding 1

                                                10101002 buiding 2

                                                ..

                                  10102 cars

                                          10102002 car1

                                          10102003 car2

      2 liabilities

                   201 Capital

                   202001 short term liabilities

       

       

      i am really tierd from keeping trying to do it , i would like to use the  tree controler

      can any body help in that

       

      i tryed to use that cade with the AdvancedDataGrid but i think using Tree controler is sutable for that :

       

      <mx:AdvancedDataGrid id="adg1"  designViewDataType="tree"
                                   creationComplete="adg1_creationCompleteHandler(event)"
                                   width="100%" height="20%"
                                   >       
                  <mx:dataProvider>
                      <mx:GroupingCollection id="gc" source="{AccChart}"
                                             childrenField="AC_NAME">
                          <mx:grouping>
                              <mx:Grouping >
                                  <mx:GroupingField name="AC_LEVEL" />
                                  <mx:GroupingField name="AC_MAINAC_NO" />
                              </mx:Grouping>
                             
                          </mx:grouping>
                      </mx:GroupingCollection>
                     
                  </mx:dataProvider>
                  <!--<mx:dataProvider>
                  <mx:HierarchicalData id="gc" source="{AccChart}"
                  childrenField="AC_LEVEL" />
                  </mx:dataProvider>-->
                  <!--<mx:groupedColumns>
                  <mx:AdvancedDataGridColumn dataField="AC_NAME" />
                  <mx:AdvancedDataGridColumnGroup headerText="DETAILS">
                  <mx:AdvancedDataGridColumn dataField="AC_MAINAC_NO"/>
                  <mx:AdvancedDataGridColumn dataField="AC_NAME"/>
                  <mx:AdvancedDataGridColumn dataField="AC_ANAME"/>
                  </mx:AdvancedDataGridColumnGroup>   
                  </mx:groupedColumns>-->
                 
              </mx:AdvancedDataGrid>

       

      and this what i got http://msmdk.selfip.com:8500/accounts/bin-debug/accounts1.html

       

      i would like to create multiple level tree using the same ArrayCollection as selecting the top level accounts (level 1) then under eatch main account comes the child acccounts and so on .

       

      Can any one please help or send link that i can see how multilevel tree can be done with the same dataprovider

       

      Ty