• 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
RE: Core Data: Master-Detail question <-- 'contextSet' binding doesn't appear to work.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Core Data: Master-Detail question <-- 'contextSet' binding doesn't appear to work.


  • Subject: RE: Core Data: Master-Detail question <-- 'contextSet' binding doesn't appear to work.
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Fri, 23 Dec 2005 20:31:48 -0800

What you want to do is attach your ingredients controller to your recipe controller using bindings. So in the ingredients controller setup a contentSet binding that is attached to recipe with selection, do NOT use arrangedObjects. When the selection is changed in the popup the selection will be changed in the recipe controller and it's corresponding ingredients will change. If you just have the managedObjectContext binding setup and no contentSet with selection binding setup, it will pull all of the ingredients from that database which is what I assume is happening now.

Hope that helps
--
Matt Ronge
http://www.theronge.com


Thanks for the speedy reply.
Instead of the 'Core Recipe' paradigm, I'm using a geography paradigm.

I've been coding the back end and have loaded the NSMangedObjectContext with master-detail:
Region Entity -->> Country Entity -->> SubRegion Entity -->> City Entity.

Here are some test data:
Europe -->>{France, Switzerland}

North America -->>{Canada, USA}
-------------------------------------------
As seen via GDB:
(gdb) po [[regionArray objectAtIndex:1] valueForKey:@"name"]
Europe

(gdb) po [[regionArray objectAtIndex:1] valueForKeyPath:@"country.name"]
<NSCFSet: 0x4836520> (France, Switzerland)

------------------------------------
(gdb) po [[regionArray objectAtIndex:0] valueForKey:@"name"]
North America

(gdb) po [[regionArray objectAtIndex:0] valueForKeyPath:@"country.name"]
<NSCFSet: 0x4836ab0> (USA, Canada)


=========
Via Interface Builder:
Two NSArrayControllers: {RegionArrayController --->> CountryArrayController}

I'm using the Model Key Path set to 'country' relationship link.

CountryArrayController: {Attributes: Entiy-->"Country"; Binding: contextSet = selection.country(RegionArrayController); managedObjectContext = managedObjectContext(File's Owner)}

RegionArrayController: {Attributes: Entity->"Region"; Binding: managedObjectContext = managedObjectContext(File's Owner)}

The contents of the Country NSTableView is the arrangedObjects binding from the CountryArrayController.
--------------------

My problem: CountryArrayController's 'contextSet' binding doesn't appear to work.

But if I DON'T use the contextSet binding in the CountryArrayController, I DO get DATA as per back-end supplied for both the region NSPopupButton and the NSTableView Country data.


Am I missing something here?

Regards,

Ric

P.S. Merry Christmas!
_______________________________________________
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
  • Follow-Ups:
    • Re: Core Data: Master-Detail question <-- 'contextSet' binding doesn't appear to work.
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: KVO one-step listening but two-step notifying?
  • Next by Date: What's the name of the color used in xCode status bar?
  • Previous by thread: Re: Core Data compare NSNumber question
  • Next by thread: Re: Core Data: Master-Detail question <-- 'contextSet' binding doesn't appear to work.
  • Index(es):
    • Date
    • Thread