1

Am I correct in my understanding of how to populate an NSOutlineview with an NSTreeController who is bound to two seperate entities that have a relationship between them:

My NSTreeController has a managedObjectContext bound to my appDelegate. My Object Controller for this is an entity named clients. My NSOutlineViews tableColumn is bound to the NSTreeController (and clients) key path clientCompany and this populates my NSOutlineView correctly with a list of company names.

My second entity, projects, has a relationship property called projectParent inverse-bound to a property in clients called clientChild. Through this relationship, I want the children of my NSTreeController to be made up of the relevant projects entries that have the relevant clientCompany as a parent.

To attempt this, I made clientChild the children key path in my NSTreeController and then bound my content set of the same controller to the clientChild key path of my clients entity with the Controller Key as 'selected'.

This method and various combinations don't seem to work and produce varying errors. It's only if I leave out that last 'content set' binding step that the program runs without errors on startup and has open/close icons next to the the outlineview entries, suggesting it populated like I wanted. On trying to open one of the entries, it produces an error suggesting my projects entity isn't KVC compliant with my clientChild property. I've gone over and over the bindings and can't seem to find the problem.

biscuitstack
  • 11,591
  • 1
  • 26
  • 41
  • Just to add: I see where I may be going wrong with the fact that I haven't defined what property of projects I want to be listed in the outlineview as a child. I tried defining it as clientChild.projectTitle in children but this didn't remove the errors. – biscuitstack Feb 22 '11 at 18:17
  • I'm still in progress on this but I've been going down the route of avoid NSTreeController and attempting to programmatically make my own datasource and delegate to combine the 2 existing entities into linked nodes in an outlineview. I'm still surprised there isn't an easier way to do this. It seems silly that IB has all of its binding features but can't make a bound NSOutlineView of parents and children using existing entities that contain parent and children relationships – biscuitstack Mar 03 '11 at 13:16

1 Answers1

1

From over a weeks worth of reading and researching, I believe the answer is that this isn't possible. This surprises me a little - considering all the time saver shortcuts that Interface Builder and NSTreeController provide, I thought my situation was common enough that this would have been implemented in Interface Builder or a built-in class.

I'm not in the process of creating my own class to do what I want and hopefully this answer is useful to anybody who was searching for this and couldn't find many answers (google wasn't much use).

biscuitstack
  • 11,591
  • 1
  • 26
  • 41