Re: Model change behind NSTreeController's back
Re: Model change behind NSTreeController's back
- Subject: Re: Model change behind NSTreeController's back
- From: George Orthwein <email@hidden>
- Date: Wed, 9 May 2007 11:42:34 -0400
NSTreeController manages one type of object, or one Entity right? So
it makes perfect sense that if the tree controller is set to manage
"OutlineGrouping" objects that an "Item" object type wouldn't show
up. ALL the objects must be of that entity, not just the top-level
(parent) objects.
Setting the tree controller to manage Node objects should work, since
the other two are sub-entities, but now the "group" relationship
points to children for OutlineGrouping objects while it is used to
point to parents for Item objects. So rename them so the child path
name is consistent.
If that still doesn't work, I would probably forget trying to use the
sub entities OutlineGrouping and Item and instead move all their
attributes to Node (especially since OutlineGrouping currently has no
unique attributes). Set up the parent/child relationship on the
single entity as seen in /Developer/Examples/CoreDate/OutlineEdit/.
But if all you are dealing with is a two level structure that is
basically "items" and "categories", then it may be easier to skip the
tree controller and feed the outlineview not with bindings but with a
datasource. I haven't done this so perhaps it has its own drawbacks.
http://developer.apple.com/documentation/Cocoa/Conceptual/OutlineView/
Articles/UsingOutlineDataSource.html
I'm actually not sure why I didn't try that when I was wrestling with
tree controller. I guess I wanted a flexible, encompassing solution
and felt like it *should* work. However, as many posts testify,
getting it to work fully can be quite difficult.
George
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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