Re: how do i filter children with NSTreeController/NSOutlineView/Core Data
Re: how do i filter children with NSTreeController/NSOutlineView/Core Data
- Subject: Re: how do i filter children with NSTreeController/NSOutlineView/Core Data
- From: Ken Victor <email@hidden>
- Date: Tue, 6 Jun 2006 17:40:44 -0700
thanx. worked like a charm! :-)
ken
At 4:36 PM -0700 6/6/06, Pierce T. Wetter III wrote:
On Jun 6, 2006, at 3:58 PM, Ken Victor wrote:
one of my core data model entities is actually a tree; ie, each
entity has a one to many relationship (parent->>children) and the
child enitity has a one to one relationship (child->parent). both
child and parent are the same type of entity.
using an NSOutlineView bound to a NSTreeController i can get my
outline view to display properly by setting a filter predicate of
"parent==nil" in IB. i can even successfully filter the top level
objects by adjusting the filter predicate in IB.
but how can i filter the children? eg, consider that this entity
has an attribute that can have the value of 1, 2, or 3. any parent
(ie, a parent with a value of 1, 2, or 3) can have children with
all values. i'd like to be able to filter the results to show only
parents and children with one value (eg., 2).
can this be done? if so, how? or could someone point me to some
example or documentation that explains how to do this?
If you want dynamic filtering I'm doing stuff like this by NOT
using NSTreeController. Instead, I faked an outline view with
NSTableView and NSArrayController. Others have done this writing
their own version of NSTreeController, which is where I'll get
eventually. For instance, in an NSOutlineView, if the child is
visible, you want the parents to be visible too...
If you want static filtering, have "filteredChildren" return the
filtered set of children, and then use that for your children
binding.
Pierce
_______________________________________________
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