0

Here is my CoreData model. The relationship is unordered.

cd model

I would like to have this model populate a pair of NSPopUp buttons like this:

cd model

When the team popup is selected, the player popup should populate with the applicable players of the selected team which will then be selected by the user.

Here is what I have tried:

I've created two NSArrayControllers, TeamList and PlayerList, both set to entity mode, with the CD-moc. For my bindings, I do the following:

Bind the team popup content to TeamList with controller Key arrangedObjects
Bind the team popup content values to TeamList with controller Key arrangedObjects and Model Key Path teamName

Bind the player popup content to PlayerList with controller Key arrangedObjects
Bind the player popup content values to PlayerList with controller Key arrangedObjects and Model Key Path playerName

This seems to be working, without any regard for the CD relationship (it shows all players in the player popup).

To inflict the relationship, I attempt the following:
Bind the PlayerList array controller content set to TeamList with controller key selection and model key path playerList.

This initially pulls in the subset of the players for the "selected" team, but doesn't repopulate when the user alters the Team popup.

BTW, I believe this (unanswered) question was asked here:
How to create two cascade NSPopUp button with Core-Data binding

Any hints on how I can make this work?

What would be a real bonus is to have only one popup with embedded submenus (Team > Player).

Community
  • 1
  • 1
zzyzy
  • 973
  • 6
  • 21

1 Answers1

1

I don’t see you binding the team popup’s selection with the TeamList array controller selection, so it makes sense the PlayerList would stick with the initial selection in the master.

Wil Shipley
  • 9,343
  • 35
  • 59