Re: filtering a tableView from a pulldown
Re: filtering a tableView from a pulldown
- Subject: Re: filtering a tableView from a pulldown
- From: "I. Savant" <email@hidden>
- Date: Wed, 29 Oct 2008 10:42:50 -0400
On Wed, Oct 29, 2008 at 4:49 AM, Amy Heavey <email@hidden> wrote:
> The pop up has selectedObject bound to Purchase Order Array Controller 2
> selection.orderReference
...
> At the moment the content Object is bound to selection.orderReference of the
> Purchase Order Array Controller.
Okay, but what is "orderReference"? Is it an attribute holding the
order number? If so, this is at least part of your problem. You
probably want the *content values* (the strings displayed in the
popup, which represent the actual objects being listed) bound to
arrangedObjects.orderReference, but the selected *object* should
probably not be the order number. The controller key should be the
"selection" but the model key path should be empty. This directly
selects the purchase order object in the array controller.
The way you have it bound now means that your Line Items
controller's content is the orderReference (which I assume is a
string, given the error you posted previously). A string probably
won't contain a list of line items, right? I assume your PurchaseOrder
entity has a to-many relationship to the line items (we'll call it
"lineItems" for obvious reasons). If this is the case, then your Line
Item controller's content should be bound to the Purchase Order
controller's "selection.lineItems". This means the Line Item
controller's contents points to an NS[Mutable]Set containing the line
items of the selected purchase order.
> I tried to bind the contentArray to that but it threw an error,
You want the content *set*. To-many relationships in Core Data deal
with NS[Mutable]Sets, not arrays. Both of these points are thoroughly
covered in the documentation, but you have to understand that you're
dealing with two separate mechanisms that happen to be designed to
work well together. This means there are two different areas of the
documentation that you need to read carefully.
> I have read through [the documentation], and it's not as much that it doesn't make sense, I
> can see what it's saying, it's applying it that I'm struggling with ...
Don't feel bad ... Cocoa Bindings is a deceptively complicated thing
to model mentally. Add Core Data to the mix and it's even harder -
even after you get the hang of it, you can easily keep making the same
mistakes and forgetting the same "gotcha's". NSPopUpButton bindings
alone really get people. That and master/detail setups seem to be the
most confounding topics for those who are just learning.
--
I.S.
_______________________________________________
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