Implementing search field in core-data app
Implementing search field in core-data app
- Subject: Implementing search field in core-data app
- From: Martin Hewitson <email@hidden>
- Date: Mon, 4 Jan 2010 11:53:00 +0100
Dear list,
I have a fairly basic core-data model with a set of Category entities, each category contains then a set of Item entities. What I want to do is implement a search field which searches all items from all categories - something like the searching is done in Mail.app.
I'm not really sure how to go about this. I've tried binding the predicate bindings of an NSSearchField to the Item array controller, but this only searches in the items of the currently selected category (since the array controller is bound to categorycontroller.selection.items).
I also tried making another array controller which contains all items and then set a filter predicate on this depending on the user having chosen a state: 'all categories' or 'currently selected category'. Then I bound my table view to this 'all items array controller'. But this is not so nice since the relationship between categories and items is not automatically handled.
Is there a 'correct' way to attack such a problem, or has someone else managed to implement a search interface something like Mail.app?
Best wishes,
Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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