Re: Filtering a table view using NSSearchField
Re: Filtering a table view using NSSearchField
- Subject: Re: Filtering a table view using NSSearchField
- From: Matt Neuburg <email@hidden>
- Date: Tue, 15 Sep 2009 11:29:17 -0700
- Thread-topic: Filtering a table view using NSSearchField
On Mon, 14 Sep 2009 17:36:57 -0600, PCWiz <email@hidden> said:
>Hi,
>
>I'm trying to filter a NSTableView using the contents of an
>NSSearchField. I have an Array Controller and table columns bound to
>key paths in the array controller. So for example I have the table
>column for name is bound to Array Controller.arrangedObjects.name.
>
>Everything up to this point is working fine, as the table view is
>populated with info correctly and all. What I want to do now is filter
>the contents of the table view (based on the name column) using text
>typed into an NSSearchField. So if the user types "test" into the
>search field, then anything row that doesn't contain "test" in its
>name gets removed.
>
>I know this is somehow possible using bindings and predicates, but im
>not sure exactly how to do it.
Download my app Thucydides. It's short and sweet and comes with example
source code which exemplifies exactly what you're describing. In fact, what
you're describing is just about all it does.
(And it's still working, unchanged, after all these years, even in Snow
Leopard...; the interface behavior has gotten a *little* creaky and
eventually I'll update it, but I'm in no rush.) m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
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