Hi Tracy, Thanks for your help to a newbie like me. Learning a lot from this group.
I found another implmentation of the datagrid searching, although some of the codes are all so NEW to me. http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-items-in-a-datagrid-in-flex/ But I think this one is much better - Search and Filtering. http://blog.sbistram.de/2009/01/14/flex-enhanced-search-flex3-datagrid/ Althoug on the second one (Search and Filtering), when I try to read the codes, I don't know which I should just get. Basically, I just need the filter/search functionality for the datagrid. Thanks. ________________________________ From: Tracy Spratt <[email protected]> To: [email protected] Sent: Wednesday, 27 May, 2009 11:27:49 Subject: RE: [flexcoders] Flex DataGrid Filter via Popup Window var winFilter:FilterDia log = PopUpManager. createPopUp( this, FilterDialog, true) as FilterDialog; winFilter.dg = myDataGrid. In FilterDialog, expose “dg” as a public property using a setter function. Tracy Spratt, Lariat Services, development services available ________________________________ From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On Behalf Of Angelo Anolin Sent: Monday, May 25, 2009 8:18 PM To: flexcod...@yahoogro ups.com Subject: Re: [flexcoders] Flex DataGrid Filter via Popup Window Hi Tracy, Care to show some example codes on how to pass the datagrid reference? Thanks. Kind regards, Angelo ________________________________ From:Tracy Spratt <tr...@nts3rd. com> To: flexcod...@yahoogro ups.com Sent: Monday, 25 May, 2009 22:49:54 Subject: RE: [flexcoders] Flex DataGrid Filter via Popup Window Of course, there are many ways to do this, but one simple approach would be to pass a reference to the dataGrid into the pop-up. That would give you access to the DG.columns array to populate your columns ComboBox. Tracy Spratt, Lariat Services, development services available ________________________________ From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On Behalf Of Angelo Anolin Sent: Monday, May 25, 2009 10:07 AM To: flexcod...@yahoogro ups.com Subject: Re: [flexcoders] Flex DataGrid Filter via Popup Window Some updates on this. Instead of the codes inside a function, what I did was create a custom MXML Component (selecting File | New | MXML Component) and selecting TileWindow on the Based As dropdown list. In the button, I created a function that calls the MXML component via the following codes: private function launchFilterDialog( ) :void { var winFilter:FilterDia log = PopUpManager. createPopUp( this, FilterDialog, true) as FilterDialog; PopUpManager. centerPopUp( winFilter) ; } Next step is to be able to pass the column names as defined in the datagrid and bind those column names into the combo box which I placed in the MXML component. So I am left with the following things to do: 1. Get the column names of the datagrid which is in the calling flex application. 2. Pass those column names into the MXML component and bind them into the combo box. 3. When a selection is made on the filter dialog window and valid filter is specified, clicking on the OK button would filter the datagrid of the calling flex application. 4. A clear button would clear the filter(s) specified on the datagrid. Inputs would be highly appreciated in doing Item no. 1 Thanks. ________________________________ From:Angelo Anolin <angelo_anolin@ yahoo.com> To: flexcod...@yahoogro ups.com Sent: Monday, 25 May, 2009 15:48:25 Subject: [flexcoders] Flex DataGrid Filter via Popup Window Hello FlexCoders, I am trying to implement a datagrid filtering mechanism to datagrids in my application. In this process, I want to show a popup window where it would act like a response window. The popup window will contain three controls, namely, two comboboxes, and a textinput control. One of the combo box would contain the columns currently displayed in the datagrid. The other combo box would contain common comparison operators (i.e. =, !=, >, <, like, etc.). Of course, there would also be two buttons - OK and Cancel to perform the filter operations. I found a popup panel example here.. http://blog. flexexamples. com/2007/ 08/06/creating- custom-pop- up-windows- with-the- popupmanager- class/ But in this example, he is defining the content of the popup panel. Since we know that the controls in the popup panel is fixed, would it be possible to just create another control which contains the controls we have defined? Then, the combobox panel would be populated with the columns in the datagrid where it was called. When the column selection from the combo box is made, the operator also selected and the text input is filled up with the value to filter, clicking on OK button would filter the datagrid. Another reason that I wanted that the filter mechanism reusable because I have a lot of mxml with datagrid that requires the same filter functionality. It would not be too good if I would place all the codes in each mxml, right? I am not sure if this approach would be good. If in case you have other approach on how to filter the datagrid, kindly let me know. Thanks.

