Re: Core Data Key-value question
Re: Core Data Key-value question
- Subject: Re: Core Data Key-value question
- From: Greg Herlihy <email@hidden>
- Date: Sun, 19 Feb 2006 09:15:23 -0800
- Thread-topic: Core Data Key-value question
>From your description I get the impression that you are using only one
NSArrayController when in fact you will need two NSArrayControllers - one
for the list of departments and one for the list of students in (what I
assume is) the currently selected department.
The Student NSArrayController binds to the department NSArrayController's
selection.students as its ContentSet - while the column in the Student table
should bind to the arrangedObjects.name path in the Student
NSArrayController (and not bind to the Department NSArrayController at all.
As you found out that binding will not work. Remember that an
NSArrayController manages only a set of objects described by one
relationship - so a single NSArrayController could not be used to maintain
both a set of departments and a set of students - for that reason you will
need to have one array controller for each.)
This pattern in which a set of data varies according to the selection in
another set of data is in fact a Master/Detail type of configuration. It is
also very similar to the one described in Apple's core data bindings
tutorial. So it may also be helpful to review that document for more
information and, no doubt, for a clearer explanation.
Greg
On 2/19/06 5:47 AM, "Bryan Zarnett" <email@hidden> wrote:
> I have created two models both of which have inverse relationships to the
> other.
>
> "Department" has a relationship "students" which is a
> to-many-relationship to "Student". Student has a relationship
> "departments" which is a to-many relationship to "Department"
>
>
> My goal is to have two tables, one that shows all the departments and
> the other one that shows all students for that department.
>
> In my GUI, I have an NSTableColumn setup so that it displays all the
> departments in the system. This is setup to the array controller
> Departments and works nicely.
>
> The "Department" drop down is not working very nice. My assumption is
> that I should be doing the following:
>
> 1) Have the "Students" NSTableColumn bind to the department array controller.
> 2) Put the controller key to "arrangedObjects"
> 3) Put the model key path to "students.student.firstName"
>
> This doesn't seem to work. Can anyone provide any help on this?
>
> Regards,
> Bryan
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden