NSTableView update problem with CoreData
NSTableView update problem with CoreData
- Subject: NSTableView update problem with CoreData
- From: Andrew Kimpton <email@hidden>
- Date: Wed, 17 Aug 2005 23:15:38 -0700
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]"
The idea is that display in the NSTableView is updated to reflect the
competitors (driver name & vehicle name) for the currently selected
event. However - when items are added to the editEventCompetitors
NSArrayController (using the NSMutableSet returned from Event
valueForKey:@"Competitors" the NSTableView does not update until I
switch the editEvent NSObjectController to a different event (and back
again) with the popup menu.However even though the table is updated to
display the current competitors data it's still not updated for new
additions until I switch back and forth again.
I know my data is in the correct place in the Store since I can see it
correctly set out in the saved XML file but how do I debug this display
problem ? Are there some attributes I'm not setting correctly somewhere
? Is this not the correct approach for this problem ? Should I
'reloadData' on the NSTableView after doing an add ?
Many thanks
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