• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
entity referencing self in relationship attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

entity referencing self in relationship attribute


  • Subject: entity referencing self in relationship attribute
  • From: Gonzalo Castro <email@hidden>
  • Date: Mon, 14 May 2007 00:22:11 -0400

Hello,

I have a master-detail UI which has been so far simple to implement using Core Data and Bindings. The master UI is a list of names in a table and the detail UI is a gaggle of controls for changing the attributes of the names (checkboxes, radio buttons, text fields, tables, etc). However, one of these attributes is a list of names (buddies). These buddies could be any of the names listed in the master side of the UI.

Since selection of names in the master UI table drives the detail UI, I needed a way for the user to choose buddies from a different list of names, a buddy chooser. One way to do this is to present the user with a table of names in a sheet; the user mutli-selects names from this table and clicks OK to dismiss the sheet and then the selected names are added to the buddies table in the detail UI.

The implementation I have is as follows.

My data model has a People entity with a to-many relationship named buddies which points back to itself (Destination: People).

The master table has one column bound as:
    value
        Bind to: PeopleList (NSArrayController)
        Controller Key: arrangedObjects
        Model Key Path: name

The PeopleList array controller is bound as:
    managedObjectContext
        Bind to: Test_AppDelegate (Test_AppDelegate)
        Controller Key: <blank>
        Model Key Path: managedObjectContext

The buddy chooser window (presented as a sheet) has a table with one column bound as:
value
Bind to: PeopleChooser (NSArrayController)
Controller Key: arrangedObjects
Model Key Path: name


The PeopleChooser array controller is bound as:
    contentArray
        Bind to: PeopleList
        Controller Key: arrangedObjects
        Model Key Path: <blank>

The bindings above give me a table in the buddy chooser window from which the user can select from the list of names in the PeopleChooser.

I am at a loss on what to do when the user clicks OK in the buddy chooser sheet. How do I assign the selected names in the buddy chooser to the buddies relationship attribute?

I can certainly get the selection in the OK action by creating and connecting an outlet to the PeopleChooser array controller but then I'm drawing a blank.

Thanks for any pointers.

Gonzalo

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: entity referencing self in relationship attribute
      • From: mmalc crawford <email@hidden>
  • Prev by Date: Re: Printing with exotic margins (a basic example)
  • Next by Date: Re: two questions about child windows
  • Previous by thread: Re: Force a sleep
  • Next by thread: Re: entity referencing self in relationship attribute
  • Index(es):
    • Date
    • Thread