Re: Core Data: Filter and search results
Re: Core Data: Filter and search results
- Subject: Re: Core Data: Filter and search results
- From: "John C. Daub" <email@hidden>
- Date: Mon, 12 Feb 2007 06:33:07 -0600
- Thread-topic: Core Data: Filter and search results
on 2/12/07 12:02 AM, Colin Wheeler at email@hidden wrote:
> I've tried searching around for this, but have turned up nothing so
> far. Basically im trying to solve a problem in my app where I want to
> filter an array in a NSArrayController via a filter predicate and
> allow a user to do a live search of that filtered array via a
> NSSearchField (somewhat similar to searching playlists in iTunes)
> which also searches via filter predicate. The problem is that when
> the first filter is done and then you go to search the array on the
> NSSearchField it either resets the filter predicate or does nothing.
>
> I've tried adding something like (self contains[c] $value) to the
> filter predicate binding on the NSSearchField but that does nothing.
> Is there a way to set a filter predicate on an array to filter the
> objects and allow for a NSSearchField to further filter those results?
I haven't tried this myself but, instead of putting the predicates directly
into the NSArrayController, could you keep track of the predicates yourself
and when the user performs the action to initiate a filtration you combine
your 2 predicates into a compound predicate (e.g. myFilterPredicate &&
userFilterPredicate) and then stick that into the NSArrayController? When
the user clears the search field, you again are the one synthesizing the
predicate but then it's just myFilterPredicate that you stick in?
--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
"I hold all the combinations to give you peace of mind." - Dave Wyndorf
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden