2

I have a list of objects displayed in an NSTableView (bound to an NSArrayController). When you select an object in that list I want to show a detail view in a second NSTableView. My object has an array property. I can't figure out how to wire the bindings for this. binding to NSArrayController's selection doesn't work, as that's a single object, and NSTableView expects to be bound to an array...

Kenny Winker
  • 11,919
  • 7
  • 56
  • 78

1 Answers1

3

Create a second NSArrayController and bind its contents to the first controller using a keypath of selection.<name of your object's array property>.

So, if your first table view is displaying objects of class Person and your Person class has a children property, you would bind the second array controller to selection.children.

You need a separate array controller for each array that you want to manage in a table view.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
  • Thanks! this was very helpful. Now my `selection` property doesn't seem to be updating when the selection changes, but that's a new problem – Kenny Winker Nov 17 '11 at 01:44
  • @KennyWinker did you manage to solve the selection issue? I believe I have the same, http://stackoverflow.com/questions/24190299/nscollectionview-master-detail-binding-configuration – H.Rabiee Jun 13 '14 at 06:00