Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Garrett

macrumors regular
Original poster
Apr 4, 2007
173
0
Hello, again!

Here is my current NSOutlineView:
616719137bd64c08b74fdd136f9f018c.png


I am trying to figure out how to append a "Group", so it, it's all wrapped like:
e5f7852781061a74fe41242419e3439c.png


Anyone have any ideas? I would assume I need to grab all my data, and append a group before inserting it?
 

MrFusion

macrumors 6502a
Jun 8, 2005
613
0
West-Europe
No knows still? :confused:

I can try to answer.

I am not sure how your datamodel is constructed, but this is how I have it.

I have an entity called "Group", which has a "parent" (to one) and "children" (to many) relationship, with the inverse relationship set. To be clear, these two point to each other, it stays within this entity.
I have other entities, which are subclasses of the Group entity.

id parent = [NSEntityDescription insertNewObjectForEntityForName:groupEntityName inManagedObjectContext:moc];
id child = [NSEntityDescription insertNewObjectForEntityForName:childEntityName inManagedObjectContext:moc];
[parent addChildrenObject:child];

You could also move existing children into a parent node, by fetching them from the store.
First try to do this in code.
Drag and drop is a next step.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.