Re: NSTableView update problem with CoreData
Re: NSTableView update problem with CoreData
- Subject: Re: NSTableView update problem with CoreData
- From: Andrew Kimpton <email@hidden>
- Date: Thu, 18 Aug 2005 22:07:52 -0700
On Aug 17, 2005, at 11:15 PM, Andrew Kimpton wrote:
I'm having a problem with the contents of an NSTableView not being
automatically updated to include the additions to a NSArrayController.
I have a somewhat involved data model/bindings setup but it works
like this (all the controllers are set to use Entities and the data
is all stored through CoreData) :
I have an NSObjectController (editEvent) for an Entity of Event and
an NSArrayController (eventArray) also for an Entities of Event. A
popup menu is bound to these items so that it's menu list is a list
of events and the selected item is stored in the editEvent
ObjectController.
Event is an NSManagedObject subclass with a 1 to many relationship
'competitors' to an Entity of Competitor. The Competitor entity in
turn as a one to one relationship with a Driver (with an attribute
of Name) and a one to one relationship with Vehicle (with an
attribute of Name)
I have a second NSArrayController (editEventCompetitors) which has
an Entity type of Competitor and has it's contentSet bound to
"content.competiors [editEvent]"
I have a NSTableView with two columns the first has it's value
bound to "arrangedObjects.driver.name [editEventCompetitors]" the
second column has it's value bound to "arrangedObjects.vehicle.name
[editEventCompetitors]"
I worked around this by taking a different approach and using a
filter predicate on the editEventCompetitors array to prevent the
display of entities not associated with the selected Event and using
KVO to change the predicate as the selected event changes.
I'm still not sure why the other method has such strange behaviours -
CoreRecipes uses a similar technique to display a list of ingredients
for the selected recipe etc. It really seems like it should work fine.
Ah well....
Andrew 8-)
_______________________________________________
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