NSTreeController w/Core Data: chaining NSManagedObjects in a hierarchy
NSTreeController w/Core Data: chaining NSManagedObjects in a hierarchy
- Subject: NSTreeController w/Core Data: chaining NSManagedObjects in a hierarchy
- From: "Frederick C. Lee" <email@hidden>
- Date: Sun, 19 Mar 2006 23:37:22 -0800
NSOutlineView: I can display mother/daughter; but not mother/daughter/
grand daughter... & beyond.
Desired NSOutlineView example:
Europe <--- Region bind to RegionTreeController
France
Germany <--- Country
Bavaria <--- Province
Berlin <--- City (bottom)
Spain
...
...
Entity Relationship ('--->>' means '1:many'):
(Top)
(Bottom - Leaf)
Region --->> Country --->> Province --->> City
Their respective NSTreeControllers:
"RegionTreeController", "CountryTreeController",
"ProvinceTreeController", "CityTreeController".
The NSOutlineView (column) is bound to RegionTreeController (top).
RegionTreeController: "Children Key Path" = "country" (entity 1:many
relationship).
"Leaf Key Path" = NO.
CountryTreeController: "Children Key Path" = "province" (entity
1:many relationship).
"Leaf Key Path" = NO.
etc.
===================================================
1) Using ONLY RegionTreeController, I get:
(Note: 'V' is down arrow)
VEurope <--- clicking on Europe reveals "France", "Germany", etc.
>France
VGermany <-- clicking on "France" or "Germany", I get the
following:
[<CountryManagedObject 0x154fdf0> valueForUndefinedKey:]: this class
is not key value coding-compliant for the key country.
1a) All entities should be 'key value coding-compliant' since they're
from the Entity-Relationship object graph.
1b) So, it probably means that I need to connect the
'CountryTreeController' to the 'RegionTreeController'; somehow:
RegionTreeController <--- contentSet (country) ---
CountryTreeController.
---------------------------------------------
2) Clicking on 'Germany' I still get:
[<CountryManagedObject 0x154fdf0> valueForUndefinedKey:]: this class
is not key value coding-compliant for the key country.
Note: I tested the NSOutlineView's column bind to EACH of the four
tree controllers (Reg...City).
Each bind gave me a parent and child node in NSOutlineView.
Ex: Europe/France, German; Germany/Bavaria; Bavaria/Berlin.
=================
So my question is, How can I mimic the Core Data entity diagram in
NSOutlineview?
... In particular, how can I display 'Province' and below?
I tried connecting the respective NSTreeController/entity via
'contentSet'; without luck.
Ric.
_______________________________________________
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