Thanks for pointing that out. Yes one sould be dpHierarchy and the other should be dpHierarchy1. But still my code does not work. The following solves the issue:
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.collections.HierarchicalData; import mx.collections.ArrayCollection; //include "SimpleHierarchicalData.as"; [Bindable] private var dpHierarchy:ArrayCollection = new ArrayCollection([ {Region:"Southwest", children: [ {Region:"Southern California", children: [ {Region:"Alice Treu", Actual:44985, Estimate:45000}, {Region:"Jane Grove", Actual:44913, Estimate:45000}]} ]} ]); [Bindable] private var dpHierarchy1:ArrayCollection = new ArrayCollection([ {Region:"Southwest1", children: [ {Region:"Southern California1", children: [ {Region:"Alice Treu", Actual:44985, Estimate:45000}, {Region:"Jane Grove", Actual:44913, Estimate:45000}]} ]} ]); /* * Got this idea from this link: * http://www.joshuaostrom.com/2008/09/18/advanceddatagrid-adventures-in-binding/ */ public function populate(i:uint):void { var hd:HierarchicalData = new HierarchicalData(); if(i==1) hd.source = dpHierarchy; else hd.source = dpHierarchy1; DG.dataProvider = hd; } ]]> </mx:Script> <mx:AdvancedDataGrid id="DG" width="20%" height="50%"> <mx:dataProvider> <mx:HierarchicalData source="{dpHierarchy}"/> </mx:dataProvider> <mx:columns> <mx:AdvancedDataGridColumn dataField="Region"/> </mx:columns> </mx:AdvancedDataGrid> <mx:Button label="Button" click="populate(1)"/> <mx:Button label="Button" click="populate(2)"/> </mx:Application> On Mon, Nov 17, 2008 at 6:26 AM, valdhor <[EMAIL PROTECTED]> wrote: > I don't have AdvancedDataGrid but I do see a problem in your code: > > I assume the two buttons are to change data providers but both buttons > set the dataprovider to dpHierarchy. > >

