Re: Core Data for managing subtree?
Re: Core Data for managing subtree?
- Subject: Re: Core Data for managing subtree?
- From: "Hamish Allan" <email@hidden>
- Date: Tue, 15 Apr 2008 21:49:34 +0100
Ben,
Thanks for your reply.
On Sun, Apr 13, 2008 at 11:54 PM, Ben Trumbull <email@hidden> wrote:
> If you only want only some of the tree using Core Data objects, you could
> try having an array controller manage the extra entity, and wire its content
> into your tree controller.
Could you please elaborate on "wire its content into your tree controller"?
I have an array controller in entity mode managing the objects I want
the user to be able to add and remove from the user-editable part of
the source list. So far, so good. But to get that array to appear as
the children of one the nodes of that outline view, I have tried each
of the following (in SourceListController's awakeFromNib):
1)
NSMutableDictionary *sectionNode =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
@"SECTION", @"displayName",
[NSNumber numberWithBool:FALSE], @"isLeaf",
nil];
[self setUserEditableObjects:[sectionNode mutableSetValueForKey:@"children"]];
mySourceListData = [[NSArray alloc] initWithObjects:sectionNode, nil];
Then in addition to binding the array controller's Managed Object
Context, I also bind its Content Set to the userEditableObjects of the
SourceListController. (I thought this might cause duplication, but I
thought I'd try it anyway.)
2)
NSMutableDictionary *sectionNode =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
@"SECTION", @"displayName",
[NSNumber numberWithBool:FALSE], @"isLeaf",
nil];
[sectionNode bind:@"children" toObject:/*(IBOutlet)*/myArrayController
withKeyPath:@"content" options:nil];
mySourceListData = [[NSArray alloc] initWithObjects:sectionNode, nil];
(I'm not sure whether myArrayController.content makes sense in entity
mode, either.)
Both of these attempts failed silently, i.e., just failed to display
anything in my source list when I added an item through the array
controller, but without logging a complaint.
So how can I wire the array controller's content into my tree controller?
Thanks,
Hamish
_______________________________________________
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