I simply assign the input values to some properties of the filter whenever they change. Cheers, Ralf.
On 5/24/07, Kevin <[EMAIL PROTECTED]> wrote:
using this approach the filter functions still need to reference the view to get optional filter parameters correct. For example, if you want to filter based on a user inputed text field you can just do this: collection.filterFunction = filter.filterFunction (textFld.text); since the filter functions can not accept parameters. In thinking about this I am wondering if this would work instead: FilterClass.filterByName(collection,textFld.text); Then within the class, the static method "filterByName" will handle assigning a filter function to the collection and using the " textFld.text" to filter. Is there something that I am missing with this approach. - Kevin On May 24, 2007, at 2:02 PM, Ralf Bokelberg wrote: I'm using a FilterClass, which holds just the filterFunction and some optional ways to configure the filtering. Every collection, which needs filtering, gets an instance of this FilterClass by assigning collection.filterFunction = filter.filterFuncti on; Cheers, Ralf. On 5/24/07, Kevin <[EMAIL PROTECTED]> wrote: > > I would like to attempt to separate my filter functions from my view > so that I am not duplicating code when two views share similar filter > functions. My idea was to create a class that contains a > ListCollection and all the appropriate FilterFunctions for that > collection. The FilterFunctions would then be applied by methods in > that class. > > The problem I am having is that I can't pass any parameters to the > FilterFunction when I assign it to the specific ListCollection. The > FilterFunction seems like it needs to be tightly coupled with the > view in order to work. > > To work around this, for application wide filters, I am saving a > filter value on my model and then referencing the model from my > FilterFunction (which still isn't ideal). However in some cases this > isn't appropriate since the filter value doesn't really need to be > persisted over the entire application. > > Does anyone have any thoughts on how to accomplish this? > > Thanks for the help, > > Kevin > -- Ralf Bokelberg <ralf.bokelberg@ <[EMAIL PROTECTED]>gmail.com> Flex & Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35
-- Ralf Bokelberg <[EMAIL PROTECTED]> Flex & Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35