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 14:31:39 +0000
On 30 Oct 2008, at 14:11, I. Savant 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.
If you're binding the content object(s), this is wrong. Again, you
want the popup's *selected object*. bound to "Purchase Order Array
Controller.selection".
I did have the selected object not the content object bound.
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,
Okay, it *displays* the way you intended, but it's still designating
the orderReference string as the selected object. This is wrong. ...
The popup can be configured in various ways (for maximum flexibility
and confusion :-)). For simplicity, how about this? Remove all popup
bindings so you're starting clean. Bind the popup's Content Values to
Purchase Order Array Controller's arrangedObjects.orderReference. Bind
the popup's Selected Value to the PO controller's
selection.orderReference.
OK, done that...
With this set of bindings, the PO array controller's selection
management should work perfectly. This assumes the Line Item array
controller is also configured properly, so to verify your popup's
configuration, I'd disconnect the Line Item controller's content
binding for now just to test this.
OK, the pop up is displaying the PO orderReferences fine, however
when I change the option in the pulldown, it's changing the value of
the selected row in the table,
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,
Yeah, forget all that. It has nothing to do with Core Data because
Core Data is not an RDBMS (per the documentation). It has many
similarities but it has a number of very important differences. They
(the documentation team and developers) have coined the phrase,
"object graph management and persistence framework". Take it as
gospel. Repeat after me: Core Data is NOT an RDBMS. :-)
Core Data is NOT an RDBMS :)
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, )
Yes. Core Data was added in 10.4, the Bindings mechanism was added
in 10.3. At the time, an array controller controlled arrays (I
believe, but I may be wrong). It just wouldn't do to rename it
"NSArrayAndSetController" or to add another controller dedicated to
sets, but I can see the source of confusion. :-) Another important
aspect was added, too, which I'll mention in a moment.
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
...
But I'm still getting an error when trying to use the bindings you
suggested
above, now it doesn't like the NSSet,
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
Have I misspoken somewhere? I can't find where I might have, but you
quoted me saying, "... your Line
Item controller's content should be bound to the Purchase Order
controller's 'selection.lineItems'."
I meant for your Items controller's Content Set binding to be bound
to Purchase Order Array Controller's selection.lineItems (or whatever
your to-many relationship to your items set is called). The binding
you specified above does not follow this.
OK, I think I've done that.
So now, the pulldown filters the tableview. but there's a snag.
I select a Purchase Order in my window, and click a button which
opens the panel with the Purchase Orders 'line items' in the table.
The Purchase Order is in the pulldown, and the items in that order
are in the table.
If I now select a different orderReference in the pulldown, it
changes all of the 'lineItems' Purchase ORder to the newly selected
one, so in my table, all of those items now have a different
orderReference.
I expected to be able to select a different orderReference in the
pulldown, and for the table to update to display the lineitems for
that OTHER order.
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.
Been there. Once it clicks, you'll enjoy a brief euphoric rush,
followed by a strong desire for a shot or three of liquor. Once that's
out of your system, a lot of other Bindings-related stuff will make a
lot more sense. Stick with it.
Thanks again,
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