• 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: CoreData Relationships and Array Controllers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData Relationships and Array Controllers


  • Subject: Re: CoreData Relationships and Array Controllers
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 02 Oct 2011 12:02:43 -0700

On Oct 2, 2011, at 10:37 , Amy Gibbs wrote:

> so I tried to bind the table column to the customerBookcase array controller, arranged objects, orderItemProduct.productTitle (orderItemProduct is the relationship between CustomerOrderItems and Product)

Yeah, that obviously can't work, because "orderItemProduct.productTitle" is not a valid KVC key. "orderItemProduct" is a to-many relationship, hence represented by a collection property, and you can't use a collection property anywhere except at the end of a keypath.

What you're trying to do is a 4-level master-detail relationship display, so it's possible you can do it by chaining multiple array controllers together. (Look up the documentation for the "contentArrayForMultipleSelection" binding of NSArrayController for more info. There are also some master/detail tutorial samples out there.) This approach is likely to be fiddly and error-prone, and possibly quite slow.

However, the task of finding all the products for a customer seems to be perfectly suited to a Core Data fetch. You should be able to set a suitable fetch predicate on the array controller. You'd still have to deal with the issue of how you know to update the display when the customer-product information changes, but that's always an issue for data that's structured by to-many relationships, and you'd likely have to solve the problem anyway.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: CoreData Relationships and Array Controllers
      • From: Amy Gibbs <email@hidden>
References: 
 >CoreData Relationships and Array Controllers (From: Amy Gibbs <email@hidden>)

  • Prev by Date: CoreData Relationships and Array Controllers
  • Next by Date: NSOutlineView - display NSButtonCell only for leaf node with outlineView:dataCellForTableColumn:item: method
  • Previous by thread: CoreData Relationships and Array Controllers
  • Next by thread: Re: CoreData Relationships and Array Controllers
  • Index(es):
    • Date
    • Thread