I just recently dealt with the filterFunction and had a struggle with
it as well. Let's say for example:
/*
* Filter for a first name
*
* @param collectionObj the entire ArrayCollection/XMLListCollection
*/
private function firstNameFilter(collectionObj:Object):Boolean {
return obj.id == 'Bob';
}
In my case, I remember having a fairly complicated return condition
where it actually didn't return a Boolean but an Object by accident.
The "collectionObj" is actually the entire ArrayCollection which is
compared to your return statement and if an element qualifies, it will
return true for each element in the List. However, if the condition is
not returning a Boolean but an Object, you may just get a null. And
even if the filterFunction returns null, the dataProvider in your
datagrid may just be displaying the data cuz the condition was never
returning a Boolean in the first place which may be what is happening.
I ended up putting a trace statment inside the filterFunction to
actually examine the collectionObj and I found that I was returning an
Object and not a Boolean value.
Hope this helps...
Bob I.
--- In [email protected], "ben.clinkinbeard"
<[EMAIL PROTECTED]> wrote:
>
> Unfortunately no. The problematic code is part of a fairly complex
> application where the filtering is configured and assigned in a
> component that simply receives a reference to a DataGrid and applies
> filters to the dataProvider based on UI selections.
>
> I was unable to reproduce the issue in a simple test project, which
> implies the issue lies elsewhere, but I just don't understand how I
> could be seeing the values and results I am and still have null be
> returned.
>
> Thanks,
> Ben
>
>
> --- In [email protected], "bobignacio" <bobignacio@> wrote:
> >
> > Any chance to post your source code?
> >
> >
> > --- In [email protected], "ben.clinkinbeard"
> > <ben.clinkinbeard@> wrote:
> > >
> > > Anyone?
> > >
> > >
> > > --- In [email protected], "ben.clinkinbeard"
> > > <ben.clinkinbeard@> wrote:
> > > >
> > > > I've got a filterFunction assigned, the DataGrid that is bound
> to the
> > > > ArrayCollection shows the correctly filtered list, and debugging
> shows
> > > > that the source Array has 10 items while the collection only
has 3.
> > > > However, myCollection.filterFunction returns null.
> > > >
> > > > Anyone have an idea of what could be going on here?
> > > >
> > > > TIA,
> > > > Ben
> > > >
> > >
> >
>