Re: filtering a tableView from a pulldown
Re: filtering a tableView from a pulldown
- Subject: Re: filtering a tableView from a pulldown
- From: Amy Heavey <email@hidden>
- Date: Thu, 30 Oct 2008 12:37:34 +0000
On 29 Oct 2008, at 14:42, I. Savant wrote:
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?
Yes
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.
If I leave the model path empty, then I get an extra line in my pop
up with
<_NSControllerObjectProxy: 0x143e450>
and it doesn't auto select the chosen Purchase ORder from the
previous window. If I put orderReference in the model path then the
pop up itself displays the way I intended,
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?
correct, I think part of my problem is I am used to working with
MySQL databases, and I'm thinking along the lines of joining across a
value, I think I'm getting a bit confused between concepts,
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,
OK, so now I tried to bind the Purchase Order Items Array Controller
(which is your line items I believe), as follows:
content set -> Purchse Order Array Controller
controller key -> selection
model path -> empty
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.
Thanks, I was considering it all as Arrays, based on the fact that
they are called Array Controllers, but an Array Controller can also
use a Set as a datasource, (datasource not used here in the cocoa
sense, )
But I'm still getting an error when trying to use the bindings you
suggested above, now it doesn't like the NSSet,
[Session started at 2008-10-30 12:30:53 +0000.]
2008-10-30 12:30:55.531 powizard[13245] An uncaught exception was raised
2008-10-30 12:30:55.532 powizard[13245] Cannot create NSSet from
object <_NSControllerObjectProxy: 0x1646580> of class
_NSControllerObjectProxy
2008-10-30 12:30:55.532 powizard[13245] *** Uncaught exception:
<NSInternalInconsistencyException> Cannot create NSSet from object
<_NSControllerObjectProxy: 0x1646580> of class _NSControllerObjectProxy
I do appreciate all your help. I'm hoping if I can get this one
working I'll be able to work out others myself.
Thank You
Amy
_______________________________________________
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