This article should help:

http://jonathanbranam.net/solutions/filter-hierarchicalcollectionview-parent-child-data

and possibly this one:

http://jonathanbranam.net/flex3anatomy/class/HierarchicalCollectionView



--- In flexcoders@yahoogroups.com, "kaushal.shah05" <kshah0...@...> wrote:
>
> Here is the link to the app:
> 
> http://s256908546.onlinehome.us/advgrid/advgridfilter.html
> 
> 
> --- In flexcoders@yahoogroups.com, "kaushal.shah05" <kshah0097@> wrote:
> >
> > how do you filter an advanced datagrid?   I've tried myself with no luck.  
> > I can only get filter the fist node in the tree.
> > 
> > there are not too many resources out there for the Flex adv datagrid.  
> > Adobe should really focus on it as it's always a requirement in the 
> > corporate world.
> > 
> > (This is the modified code copied from Sameer's site.)
> > 
> > 
> > <?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>
> >
>


Reply via email to