Bindings master/detail question

  • Hi,

    Like many applications, my app has a master / detail interface, much
    like iTunes:
    I have a table containing playlists (bound to an NSArrayController).
    Based on the selection of the playlist, there is another table view
    that displays the songs. This table is bound to another
    NSArrayController (with the contentSet binding bound to the selection
    key of the first NSArrayController). This works like a charm.

    The problem is that I'd like to allow multiple selection in the
    playlist table, and reflect this multiple selection in the songs
    table. In other words, the user can select multiple playlists and
    that should result in the other table showing songs for all selected
    playlists. Therefore, I bound the contentArray binding of the songs
    NSArrayController to the selection of the playlist NSArrayController
    using the @unionOfSets.songs keypath. Again, this works fine: when
    selecting multiple playlists in the master table, all relevant songs
    are displayed in the other table.

    A problem arises when adding or deleting songs (using buttons wired
    to the standard songs NSArrayController actions). Then I get the
    following error:
    Error setting value for key path <selection....> of
    object <PlaylistController: 0x38c4f0>[entity: Playlist, number of
    selected objects: 1] (from bound object <SongsController: 0x38ac10>
    [entity: Song, number of selected objects: 1]): [<Playlist 0x355c80>
    valueForUndefinedKey:]: this class is not key value coding-compliant
    for the key @unionOfSets.

    I'm really puzzled how it's possible that this setup works fine when
    selecting and displaying, but can't be used to add or remove songs.

    Thanks in advance for any advise you can provide.

    Peter
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today