Re: Core Data: Filter and search results
Re: Core Data: Filter and search results
- Subject: Re: Core Data: Filter and search results
- From: Colin Wheeler <email@hidden>
- Date: Mon, 12 Feb 2007 21:29:16 -0600
Well I thought up of an idea which sounded nice, but I am unable to
get it working. Basically I'd have 2 NSArrayControllers. 1 of these
array controllers would have all the objects from 1 entity type in it
and then bind the 2nd array controllers contentArray to the first
with the controller key arrangedObjects. So when I wanted I could
filter the first array controllers objects and then bind the filter
predicate in the NSSearch field to the 2nd array controller, thus I
would be able to filter the array in the 1st array controller and
then allow the user to perform a search via a filter predicate on the
2nd NSArrayController.
My problem is I can't get any objects to show up in the 2nd array
controller at all. What do I need to do to get the arranged objects
of the 1st array controller into the 2nd via bindings?
Colin
On Feb 12, 2007, at 6:33 AM, John C. Daub wrote:
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
_______________________________________________
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