4 Replies Latest reply on May 21, 2008 1:20 AM by BaliHi

    Stuck in the AdvancedDatagrid

    BaliHi Level 1
      Hi All,

      I want to access the data within the Advanced Datagrid but I cant seem to do it. I have defined some summary data using Grouping Collections and a summary row. Now I want to use that data to do something else.

      I have found that the advancedDataGrid has a property called HierarchicalCollectionView and HierarchicalCollectionView has a property called treeData. Whilst treeData has the data that I want to use (summaries of my leaf level data), unfortunately it is a protected property so I cant refer to it using code. In the debugger you can see it with a little yellow diamond next to it.

      I am trying to figure out whether I can use inheritance or maybe composition in Actionscript to get the contents of treeData but everything I have tried has failed so far.

      Alternatively is there another way of getting to that data?
        • 1. Re: Stuck in the AdvancedDatagrid
          Sreenivas R Adobe Employee
          You can use the iterator of HierarchicalCollectionView and get to the summary nodes. (You may have to open all the nodes if you want to proces all summary nodes)
          • 2. Re: Stuck in the AdvancedDatagrid
            BaliHi Level 1
            Thanks, that looks like it will work but can you give me some more information on how I would iterate through the HierarchicalCollectionView?

            I can see that after opening all the nodes, HierarchicalCollectionView.OpenNodes becomes an object with child objects that contain all the information I need. I can get the length of HierarchicalCollectionView, but how do I refer to the individual nodes below? Here is some code that doesnt work - maybe you can provide a quick correction or a re-write:

            var myHierCollView:IHierarchicalCollectionView = dgVwFinData.hierarchicalCollectionView;
            //open all the nodes
            dgVwFinData.expandAll();

            //loop through the HierarchicalCollectionView
            for(var i:int=0; i<myHierCollView.length; i++)
            {
            //how do I access the individual items in myHierCollView
            //the following doesnt work
            var currentNode:Object = myHierCollView ;
            }
            • 3. Re: Stuck in the AdvancedDatagrid
              Sreenivas R Adobe Employee
              You need to call myHierCollView.createCursor() and use the IViewCursor returned.

              while(!cursor.afterLast)
              {
              var node:Object = cursor.current;
              cursor.moveNext();
              }
              • 4. Re: Stuck in the AdvancedDatagrid
                BaliHi Level 1
                Thanks Sreenivas R, you're a top man