I was able to work around the missing openItems by listening to the
itemOpen and itemClose events and store the array on my own.
public function listenToOpenings(event:AdvancedDataGridEvent) : void {
openItems.push(event.item);
}
public function listenToClosings(event:AdvancedDataGridEvent) : void {
openItems = openItems.filter(function
filterOpenList(currentElement:*, index:int,arr:Array) : Boolean {
return currentElement != event.item;
}) as Array;
}
I'm still curious what the logic behind removing it was. Is there a
new/different way to track open nodes now?
...paul
On 10/1/07, Paul Dale <[EMAIL PROTECTED]> wrote:
> I made some progress on my 'filtering hierarchical data' issue.
>
> Using a 'GroupingCollection' and calling 'refresh' on it whenever the
> text in the search box changed I was able to get a properly function
> serarch. However, in the new Beta 2 the 'openItems' property of the
> AdvancedDataGrid is gone.
>
> Can anyone 'in the know' comment on why it was removed? How should one
> keep a tree open after a 'refresh'?
>
> My test code below for anyone who is interested ...
>
> Paul
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute"
> applicationComplete="init()">
> <mx:Script>
> <![CDATA[
> import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
> import mx.collections.GroupingField;
> import mx.collections.Grouping;
> import mx.collections.ArrayCollection ;
> import mx.collections.GroupingCollection;
>
>
> public function init() : void {
> flatData.filterFunction = myFilter;
> }
> public function myFilter(item:Object) : Boolean {
> var pattern:String = '.*' + search.text + '.*';
>
> if (item.hasOwnProperty('Territory')) {
> if (item.Territory.match(pattern)) {
> return true;
> } else {
> return false;
> }
> }
> return true;
> }
>
> public function updateFilter() : void {
> groupedData.refresh();
> }
>
> [Bindable] private var flatData:ArrayCollection = new
> ArrayCollection(
> [
>
> { Territory:"Nevada", Territory_Rep:"Barbara Jennings",
> Estimate:40000 , Actual:38865 },
> { Territory:"Nevada", Territory_Rep:"Dana Binn" ,
> Estimate:30000 , Actual:29885 },
> { Territory:"Nevada", Territory_Rep:"Joe Schmoe" ,
> Estimate:30000 , Actual:29134 },
> { Territory:"Northern California" , Territory_Rep:"Lauren
> Ipsum" , Estimate:40000 , Actual:38805 },
> { Territory:"Northern California" , Territory_Rep:" T.R.
> Smith" , Estimate:40000 , Actual:55498 },
> { Territory:"Southern California" , Territory_Rep:"Jane Grove"
> , Estimate:45000 , Actual:44913 },
> { Territory:"Southern California" , Territory_Rep:"Alice Treu"
> , Estimate:45000 , Actual:44985 },
> { Territory:"Nevada" , Territory_Rep:"Bethany Pittman" ,
> Estimate:45000 , Actual:52888 } ,
>
> ]);
>
> ]]>
> </mx:Script>
> <mx:HBox>
> <mx:Label text="Territory" />
> <mx:TextInput id="search" text=""
> change="updateFilter()"/>
> </mx:HBox>
>
> <mx:AdvancedDataGrid id="adg"
> creationComplete="groupedData.refresh()" x=" 29.5" y="26" width="555"
> height="377">
> <mx:dataProvider>
> <mx:GroupingCollection id="groupedData" source="{flatData}" >
>
> <mx:Grouping>
> <mx:GroupingField name="Territory" >
> <mx:summaries>
> <mx:SummaryRow summaryPlacement="group">
> <mx:fields>
> <mx:SummaryField
> dataField="Estimate" operation="SUM" label="Budget"/>
> <mx:SummaryField
> dataField="Actual" operation="SUM" />
> </mx:fields>
> </mx:SummaryRow>
> </mx:summaries>
> </mx:GroupingField>
> </mx:Grouping>
> </mx:GroupingCollection>
> </mx:dataProvider>
> <mx:columns>
> <mx:AdvancedDataGridColumn width="200" headerText =
> "Territory Rep" dataField="Territory_Rep"/>
> <mx:AdvancedDataGridColumn headerText="Budget"
> dataField="Budget"/>
> <mx:AdvancedDataGridColumn headerText = "Actual"
> dataField="Actual"/>
> </mx:columns>
> </mx:AdvancedDataGrid>
>
> </mx:Application>
>