Any way to filter an NSTreeController?
Any way to filter an NSTreeController?
- Subject: Any way to filter an NSTreeController?
- From: Jens Alfke <email@hidden>
- Date: Wed, 7 May 2008 15:48:51 -0700
I'm using an NSTreeController bound to an NSBrowser to display a
hierarchical data structure in my app.
I now find I need to implement filtering, i.e. hiding items at all
levels of the hierarchy that don't match some condition.
Unfortunately it appears that only NSArrayController supports a -
filterPredicate; there's no equivalent in NSTreeController. :-(
At this point it seems like my options are either
(1) Add the filtering to my data model, i.e. have my content classes' -
children methods filter their results … I don't want to do this
because it prevents the same data model from appearing in two views
with different filters.
or
(2) Create a parallel hierarchy of filtered objects and give that to
the tree controller … I don't want to do this because it having the
proxy objects mimic the original ones to KVC / KVO will be a pain, but
otherwise I have to change around all of the bindings in my nib.
Is there some other alternative? I know NSTreeController already
builds its own shadow hierarchy of NSTreeNodes … is there a way I can
subclass NSTreeController or NSTreeNode to splice in the filtering?
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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