Let’s say that we have the following model:
Entity1: Person
relationship: jackets
Entity2: Jacket
attribute: size
relationship: owner
So we have:
owner <–>> jackets (each person can have many jackets, but a jacket can only have one owner)
Let’s set up a NSTableView with 2 columns. I bind the first one to show all persons. Then I want the second column to show the jackets’ sizes owned by the selected owner in the first column. To get the first column is trivial, but how do I bind the second? Do I need another NSArrayController to represent Jackets entities or can I do it directly using something similar to (this didn’t work) binding the column to Persons NSArrayController and under value bind controller key: selection & Model Key Path: arrangedObjects.size. When I try this i get the error:
[ addObserver: forKeyPath:@”arrangedObjects.Jacket.size” options:0x0 context:0x0] was sent to an object that is not KVC-compliant for the “arrangedObjects” property.
Thanks,
Hans
I finally solved it. I did two mistakes:
I was trying to plot a tree like structure in one NSTableView. Since this did not support that I had 3 instances in the first and hundreds in the second table.
I had to bind a new NSArrayController to the second NSTableView and bind its content set to the selection of my Jackets NSArrayController.
That solved it!