• 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
filtering in NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

filtering in NSTreeController


  • Subject: filtering in NSTreeController
  • From: Steven Parker <email@hidden>
  • Date: Wed, 25 Jan 2006 15:46:10 -0700

I am using NSTreeController in an application (with CoreData if that matters), and am finding myself painted into a corner.

I have solved some problems by stumbling on the "observedObject" accessor, which seems to work like a charm except that it isn't blessed.

What is more concerning is that I cannot find a good mechanism for implementing filtering in the tree. With CoreData I can implement a predicate to filter the top level nodes but have not figured out how to perform complex filtering throughout the tree.

The only thing I found with google was this gentleman trying to do something similar:
http://www.cocoabuilder.com/archive/message/cocoa/2005/6/21/139588
but it appears to be a dead-end.


The only other option seems to be here:
http://www.sixthhappiness.ca/blog/2005/08-21/

Unfortunately, this example implements filtering by overriding isLeaf, countOfChildren, and getChildren... in the tree node to implement the filter. This breaks the MVC model by putting the V in the M. It also makes it difficult or impossible to have multiple filtering criteria simultaneously displayed in different views.

One trivial example of this would be something like the OutlineView developer example but with two outlines - one that showed the full outline and one that only showed the first child for the lowest level of the tree. Filtering in the Note data structure would allow only one of the two at a time, not both. Another example would be a search that showed the nodes that matched a search string, plus displayed all of their ancestors.

I would like something similar to arrangeObjects: in NSArrayController, where I could filter (and arrange) objects at each node in the tree.

Are things like this possible with NSTreeController? Am I barking up the wrong tree (pun intended)? Any advice would be greatly appreciated.

Steve Parker

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • Next by Date: Re: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • Previous by thread: Re: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • Next by thread: ToolBar Icons not sorted
  • Index(es):
    • Date
    • Thread