3 Replies Latest reply on Nov 24, 2010 1:05 AM by EricJ32

    Flex 4 ADG with tree?

    EricJ32 Level 1

      I'm trying to use an ADG in a Flex 4 application. When I use the code below (which is from the Adobe help files for Flex 4), I get an error thrown by AdvancedDataGridBaseEx.as that the headerSeparatorSkinClass is null. So I set this to mx.skins.halo.DataGridHeaderSeparator. I also added the designView

       

      This solves the error, but I get no tree. The only thing I get is a white ADG with the first region (Southwest) in it - no tree hierarchy as I would expect.

      Screen shot 2010-11-23 at 6.13.07 PM.png

       

      [Bindable]

      public var dpHierarchy =

          new ArrayCollection([
                              {Region:"Southwest", categories: [
                                  {Region:"Arizona", categories: [
                                      {Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},
                                      {Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000}]}, 
                                  {Region:"Central California", categories: [
                                      {Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000}]}, 
                                  {Region:"Nevada", categories: [
                                      {Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000}]}, 
                                  {Region:"Northern California", categories: [
                                      {Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},
                                      {Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000}]}, 
                                  {Region:"Southern California", categories: [
                                      {Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},
                                      {Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}]}
                              ]}
                          ]);


      <mx:AdvancedDataGrid width="100%" height="100%" designViewDataType="tree"
                               headerSeparatorSkin="mx.skins.halo.DataGridHeaderSeparator">
              <mx:dataProvider>
                  <mx:HierarchicalData source="{dpHierarchy}"
                                       childrenField="categories"/>
              </mx:dataProvider>
              <mx:columns>
                  <mx:AdvancedDataGridColumn dataField="Region"/>
                  <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                                             headerText="Territory Rep"/>
                  <mx:AdvancedDataGridColumn dataField="Actual"/>
                  <mx:AdvancedDataGridColumn dataField="Estimate"/>
              </mx:columns>
          </mx:AdvancedDataGrid>