• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Any way to filter an NSTreeController?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: EventMonitorTarget in Cocoa
  • Next by Date: Re: -draggingEntered: never gets called [SOLVED]
  • Previous by thread: Re: find repaint areas?
  • Next by thread: Keys dependent on NSArrayController's selection
  • Index(es):
    • Date
    • Thread