Search code examples
cocoacore-datacocoa-bindingsnsarraycontroller

How bind 'remove' of an array controller with a set operator as Content


I have a data model where a 'Program' has a 1-to-many relationship with 'ToDo's and the window is setup as follows:

NSArrayController: Programs. Program Entities in the moc, prepares content, no special bindings NSTableView: Single column, Value is bound to Program, controllerKey=arrangedObjects, path=Name

NSArrayController: ToDos. Todo Entities in the moc. Prepares content and ContentArray is bound to Programs' selection for the path "@unionOfSets.Todos"
NSTableView: A few columns, bound ToDos arrangedObjects Name. (and DueDate, etc in other columns)

This is working. For each Program selected the union of all their ToDos is shown in the other table.

My problem is when I bind a button to ToDo remove action, I get the following error when pressed: the entity Program is not key value coding-compliant for the key "@unionOfSets".

I had expected the selected ToDo items to be removed from the ToDo controller, how should I go about achieving this?

Thanks in advance,
- Dave


Solution

  • Please change design to this way: NSarrayController todos selection -> contentSet "relationship name"