Sanjay

To get at the authorsDataProvider - 
use "parentDocument.authorsDataProvider"

Martin


--- In [email protected], "phipzkillah" <[EMAIL PROTECTED]> wrote:
>
> Sanjay,
> 
> Did you have any luck converting the DG Header Filter cell 
renderer to
> Flex 2.0?  These are the cons that were posted with the code 
snippet:
> 
> CONS
> 1) you must maintain the same dataProvider.
> 2) sorting is no good. you might want to re-sort after a filter is
> done (but providing events and what not are still something I need 
to
> provide, probable a modelChanged event utilizing the 
eventName 'filter'
> 
> There is still a lot to do for this renderer to make it more 
usable,
> but I figure I've gotten everyone to a dropping off point it 
shouldn't
> be too hard. As I progress with this I'll post more to this thread
> 
> #########
> 
> I'm not sure exactly what you are trying to do.  Do you just simply
> want a combo-box that you select a field in the list and have it 
sort
> the datagrid?  If so I believe you need to use an ArrayList 
collection
> for your dataprovider.  
> 
> The link that I gave you earlier seems like it would be the best 
for
> filtering a datagrid as you would be able to filter on each
> field/column by clicking on the header and selecting an item - 
which
> is exactly what Excel does.
> 
> If you were able to convert that datagrid header filter cell 
renderer
> to Flex 2.0 can you please post the source up here?
> 
> -Phil
> 
> --- In [email protected], "sanjaypmg" <sanjaypmg@> wrote:
> >
> > Hi,
> > 
> > I have tried it but facing a problem when I try to access 
> > DataCollection from another MXML testCombo.mxml. 
> > 
> > Please Suggest:::
> > 
> > See the following Code:
> > 
> > filterTest.mxml::::
> > 
> > <?xml version="1.0" ?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";  
> > xmlns="../*"  >
> > 
> > <mx:Script>
> > <![CDATA[
> >             import mx.collections.ArrayCollection;
> >             import mx.core.ClassFactory;
> > 
> > public var object2:Object = new Object();
> > public var object:Object = new Object();
> > [Bindable]
> >     
> >      
> >      [Bindable]
> >        public var authorsDataProvider : ArrayCollection = new 
> > ArrayCollection( [
> >             { Country: "USA", Gold: 35, Status:"Active", 
> > URL:"http://www.google.com"; },
> >             { Country: "China", Gold: 32, 
> > Status:"Deactive",URL:"http://www.yahoo.com"},
> >             { Country: "Russia", Gold: 27,Status:"Deactive", 
> > URL:"http://www.hotmail.com"; },
> >             { Country: "India", Gold: 12, 
> > Status:"Active",URL:"http://www.gmail.com"},
> >             {Country: "Russia", Gold: 27, 
> > Status:"Deleted",URL:"http://www.hotmail.com"; },
> >             {Country: "Russia", Gold: 27, 
> > Status:"Deleted",URL:"http://www.hotmail.com"; } ]);
> > 
> > ]]>
> > </mx:Script>
> > <mx:Panel title="Header Filter" width="100%" height="100%">
> >       <mx:DataGrid id="grid" 
dataProvider="{authorsDataProvider}" 
> > width="100%" height="100%" sortableColumns="false"   >
> >         <mx:columns>
> >           <mx:Array>
> >             <mx:DataGridColumn width="300" headerText="Country" 
> > dataField="Country" />
> >             <mx:DataGridColumn width="300" headerText="Value" 
> > dataField="Gold"/>
> >             <mx:DataGridColumn width="300" headerText="Status" 
> > dataField="Status" headerRenderer="testCombo"/>
> >             <mx:DataGridColumn width="300" headerText="URL" 
> > dataField="URL"/>
> >           </mx:Array>
> >         </mx:columns>
> >       </mx:DataGrid>
> >     </mx:Panel>
> > </mx:Application>
> > 
> > 
> > 
> > testCombo.mxml:::::
> > 
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > 
> > <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml";>
> >     <mx:Label text="Sale Price!"/>
> >     <mx:ComboBox id="cboAuthorsStatusFilter"
> >     dataProvider="{authorsStatusArray}" 
> >     change="filterAuthorsGrid();"
> >     >
> >     
> >     
> >     <!-- dataProvider="{_parent._parent.gridData}">-->
> >     <mx:Script>
> >             <![CDATA[
> >                     import mx.controls.Alert;
> >                     import mx.collections.*;
> >                     [Bindable]  
> >                     public var authorsArray:Array = ["All",
> >                     "Active",
> >                     "Deactive",
> >                     "Deleted"];
> >                     
> >                      [Bindable] 
> >                     public var authorsStatusArray : Array = 
> > populateAuthorsStatusArray(authorsArray);
> > 
> >                     public function populateAuthorsStatusArray
> > (authorsArray:Array):Array
> >                     {
> >                             //Alert.show
> > ("authorsArray: "+authorsArray.toString())
> >                             var statusArrayHashMap : Object = 
> > new Object();   
> >                             var statusArray : Array = new Array; 
> >                             var n:int = authorsArray.length; 
> >                             for (var i:int = 0; i < n; 
> > i++)             
> >                             {                    
> >                                     if (statusArrayHashMap
> > [authorsArray] == undefined)                    
> >                             
> >     {                               
> >                                             statusArrayHashMap
> > [authorsArray] = new Object();                               
> >                                             statusArray.push
> > (authorsArray[i]);                    
> >                                     } else
> >                                     {
> >                                             statusArray.push
> > (authorsArray [i]);  
> >                                     }
> >                                                
> >                             }             
> >                             return statusArray;
> >                     } 
> >                     public function filterAuthorsGrid():void
> >                     {
> >                             Alert.show(this.toString() 
> > +" : "+authorsDataProvider)
> >                     
> >     //authorsDataProvider.filterFunction=authorsStatusFilter;    
> >            
> >                             //authorsDataProvider.refresh();
> >                     }
> >                     public function authorsStatusFilter
> > (item:Object):Boolean       
> >                     {               
> >                             if 
> > (cboAuthorsStatusFilter.selectedItem != "All")               
> >                             {                       
> >                                     return item.status == 
> > cboAuthorsStatusFilter.selectedItem; 
> >                             } else {
> >                                     return true;               
> >                             } 
> >                             //return true;     
> >                     }
> >                     
> > 
> >                 ]]>
> >     </mx:Script>
> > </mx:ComboBox>
> > 
> > </mx:HBox>
> > 
> > 
> > --- In [email protected], "sanjaypmg" <sanjaypmg@> 
wrote:
> > >
> > > Thanks Phil,
> > > .... :) That's what I was looking for...Now I'll try to 
convert it 
> > > into Flex2.0.
> > > 
> > > Wish me luck.... ;)
> > > 
> > > Thanks,
> > > Sanjay
> > > 
> > > --- In [email protected], "phipzkillah" <pkrasko@> 
wrote:
> > > >
> > > > I am also looking for this functionality.  About a month ago 
I 
> > came
> > > > across this page
> > > > <http://www.cflex.net/showFileDetails.cfm?
> > > ObjectID=299&Object=File&Chann\
> > > > elID=1> .  It is a sample of a datagrid whose headers have a 
> > drop 
> > > down
> > > > list to filter each field/column on.  Unfortuneately it was 
> > > developed in
> > > > Flex 1.5.  Has anyone converted it to Flex 2.0?  If so, this 
is 
> > the
> > > > answer we all are looking for.
> > > > 
> > > > If someone can copy that source code and eliminate the 
compiler 
> > > errors
> > > > you will be doing several of us a huge favor!
> > > > 
> > > > Thanks
> > > > 
> > > > Phil
> > > > 
> > > > --- In [email protected], "sanjaypmg" <sanjaypmg@> 
> > wrote:
> > > > >
> > > > > Hi There,
> > > > >
> > > > > Is there any way to put filters feature on Datagrid as 
> > available 
> > > in
> > > > > Excel?
> > > > >
> > > > > Or
> > > > >
> > > > > Anything Similar to that feature?
> > > > >
> > > > > Please let me know if there is something or any possible 
> > > solution for
> > > > > the same.
> > > > >
> > > > > Thanks
> > > > > Sanjay sharma
> > > > >
> > > >
> > >
> >
>


Reply via email to