Re: Fun (or not) with NSArrayControllers and CoreData.
Re: Fun (or not) with NSArrayControllers and CoreData.
- Subject: Re: Fun (or not) with NSArrayControllers and CoreData.
- From: Quincey Morris <email@hidden>
- Date: Fri, 31 Jul 2009 11:01:05 -0700
On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote:
If I unbind the Content Set of the JobArrayController (so I see all
Jobs) adding some extra table columns showing the Folder name and
root Folder name, adding and removing Jobs works fine (the data
shows up in the table, and the Folder and root Folder name are
correct) using the following methods (on my window controller):
-(IBAction)newJob:(id)sender
{
id folder = [self currentFolder];
CCCEJob *newJob = [NSEntityDescription
insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext:
[self managedObjectContext]];
[folder addJobsObject:newJob];
newJob.rootFolder = [newJob getRootFolder];
}
-(id)currentFolder
{
if ([[folderTreeController selectedObjects] count]!= 0)
{
return [[folderTreeController selectedObjects] objectAtIndex:0];
}
else return nil;
}
and on Job:
-(id)getRootFolder
{
id cursor = [self folder];
while ([cursor parent])
{
cursor = [cursor parent];
}
return cursor;
}
But if I have the Content Set of JobsArrayController bound to
FolderTreeController with Controller Key: selection and Model Key
Path: allDescendantsJobs, nothing shows up in the table. I've double
and triple-checked the model to make sure the inverse relationships
are set properly.
What is selected in FolderTreeController's outline view? Your code
above implies that you select a non-root folder prior to adding a new
job (to the non-root folder). The "allDescendantsJobs" relationship
only has something in it for a root folder. Are you selecting a root
folder and seeing no jobs?
_______________________________________________
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