4 Replies Latest reply on Aug 31, 2007 10:46 AM by ebelair

    Expand Specific Levels of a Multi-Level Advanced DataGrid

    ebelair Level 1
      I have an Advanced DataGrid (ADG) which displays three levels - we'll call them "Parent", "Child", and "Child Detail" - using a HierarchicalData collection which is built from XML from a WebService:


      import mx.collections.HierarchicalData;

      [Bindable] private var myXML:XML;
      [Bindable] private var bHier:HierarchicalData;

      private function handleReportResult(event:ResultEvent):void{
      var bResult:Object = event.result;

      //create an XML object from the WebService result
      myXML = new XML(bResult);

      bHier = new HierarchicalData(myXML.children);
      bHier.childrenField = "children";


      <mx:AdvancedDataGrid id="adg" dataProvider="{bHier}">
      <mx:AdvancedDataGridColumn id="column1" headerText="" dataField="@Name" />
      <mx:AdvancedDataGridColumn id="priceCol" dataField="@Price" />

      The ADG is generated just as I would like it, and I am able to Expand All levels, as well as Collapse All levels using the expandAll() and collapseAll() methods.

      However, by default, I want the grid to display with the first level ("Parent") as the only open level. I can't seem to find a way to do this, using the existing properties and methods of the ADG class.

      Does anyone have any suggestions?