Nested binding question

  • Ok, so I have a class that I've written (not Core Data...) called Order,
    which has a property called orderItems which is an NSMutableArray of
    OrderItem instances.



    What I've done is I've created an NSCollectionView and dropped the a
    custom view into it. In this view I have a label that I want bound to
    the description of the order.



    Within this view, I also have a Table View, which I want bound to the
    orderItems NSMutableArray that is on the parent Order object.



    Can someone walk me through the steps to rig up this binding in
    Interface Builder and/or code? Every attempt I've made has come _close_,
    but the end results are always as though someone on drugs rigged up my
    bindings.



    Any help is much appreciated!! Thanks!



    p.s. I have an  array controller (Orders Controller) that I am/was using
    for the root bindings.
  • On 9/4/07, Kevin Hoffman <khoffman...> wrote:
    > What I've done is I've created an NSCollectionView and dropped the a
    > custom view into it. In this view I have a label that I want bound to
    > the description of the order.

      NSCollectionView is not in any currently-shipping version of Mac OS
    X. Surely you couldn't have meant to violate a non-disclosure
    agreement over API included in an upcoming release, could you?

      Of course not ... ;-)

    --
    I.S.
  • Ok, so, the information below is quite incorrect. NSCollectionView ...
    pfft. no idea where I got the name of that class!!

    So, theoretically, were someone to try and do this kind of nested
    binding today using Tiger, how would they go about doing it?

    -----Original Message-----
    From: cocoa-dev-bounces+khoffman=<liquidnet.com...>
    [mailto:cocoa-dev-bounces+khoffman=<liquidnet.com...>] On
    Behalf Of Kevin Hoffman
    Sent: Tuesday, September 04, 2007 1:35 PM
    To: <cocoa-dev...>
    Subject: Nested binding question

    Ok, so I have a class that I've written (not Core Data...) called Order,
    which has a property called orderItems which is an NSMutableArray of
    OrderItem instances.



    What I've done is I've created an NSCollectionView and dropped the a
    custom view into it. In this view I have a label that I want bound to
    the description of the order.



    Within this view, I also have a Table View, which I want bound to the
    orderItems NSMutableArray that is on the parent Order object.



    Can someone walk me through the steps to rig up this binding in
    Interface Builder and/or code? Every attempt I've made has come _close_,
    but the end results are always as though someone on drugs rigged up my
    bindings.



    Any help is much appreciated!! Thanks!



    p.s. I have an  array controller (Orders Controller) that I am/was using
    for the root bindings.
  • On Sep 4, 2007, at 10:52 AM, Kevin Hoffman wrote:

    > So, theoretically, were someone to try and do this kind of nested
    > binding today using Tiger, how would they go about doing it?
    >
    It's not quite clear now exactly what you want.

    Is it the case that you have an array of Order objects managed by an
    array controller (Orders Controller) and you want in a table view to
    display the Order Items associated with the current selection in
    Orders Controller?

    If so, you need a second array controller, to manage the selection.
    Its Class Name will (obviously) be OrderItem, and you bind its Content
    Array to [Orders Controller].selection.

    mmalc
  • Actually what I need is the nested binding without having a current
    selection.
    So, I need some custom views where each view is bound to an element in
    the Orders controller, and within each of those custom views, there is a
    table view that is bound to the orderItems mutable array property on the
    order item to which the view is bound.

    Hopefully that made it clearer instead of sounding more delusional :)

    -----Original Message-----
    From: mmalc crawford [mailto:<mmalc_lists...>]
    Sent: Tuesday, September 04, 2007 2:15 PM
    To: Kevin Hoffman
    Cc: <cocoa-dev...>
    Subject: Re: Nested binding question

    On Sep 4, 2007, at 10:52 AM, Kevin Hoffman wrote:

    > So, theoretically, were someone to try and do this kind of nested
    > binding today using Tiger, how would they go about doing it?
    >
    It's not quite clear now exactly what you want.

    Is it the case that you have an array of Order objects managed by an
    array controller (Orders Controller) and you want in a table view to
    display the Order Items associated with the current selection in
    Orders Controller?

    If so, you need a second array controller, to manage the selection.
    Its Class Name will (obviously) be OrderItem, and you bind its Content
    Array to [Orders Controller].selection.

    mmalc
  • On 9/4/07, Kevin Hoffman <khoffman...> wrote:
    > Ok, so, the information below is quite incorrect. NSCollectionView ...
    > pfft. no idea where I got the name of that class!!
    >
    > So, theoretically, were someone to try and do this kind of nested
    > binding today using Tiger, how would they go about doing it?

      Though nowhere near as elegant as I imagine this theoretical
    "NSCollectionView" class you're referring to, you can achieve this
    with a more standard master / detail configuration.

      Rather than have a list of objects that show the order details and a
    sublist of their line-items, you could have one table of orders
    (master) and the order information + line items view (detail) as
    separate items, the details of course being dependent on the master's
    selection. The suggestions mmalc gave you (regarding the configuration
    of the array controllers) are just right for this.

      Otherwise, you'd have to figure this fabled "collection view
    thingie" out yourself, wait until someone "officially invents" it for
    an upcoming version of OS X, or reinvent the wheel yourself for Tiger.

    --
    I.S.
  • Is it simply this?

    Order
    Item  -> view bound to Item.prop1 or prop2 and containingOrder
      prop1
      prop2
      ....
      articles array
      containingOrder
    Item  -> view bound to Item.prop1 or prop2 and containingOrder
      prop1
      prop2
      containingOrder
    Item  -> view bound to Item.prop1 or prop2 and containingOrder
      prop1
      prop2
      ....
      articles array
      containingOrder
    Item  -> view bound to Item.prop1 or prop2 and containingOrder
      prop1
      prop2
      ....
      articles array
      containingOrder

    If not / sorry I misunderstood :)
    Regards,
    Dominik

    Am 04.09.2007 um 20:17 schrieb Kevin Hoffman:

    > Actually what I need is the nested binding without having a current
    > selection.
    > So, I need some custom views where each view is bound to an element in
    > the Orders controller, and within each of those custom views, there
    > is a
    > table view that is bound to the orderItems mutable array property
    > on the
    > order item to which the view is bound.
    >
    > Hopefully that made it clearer instead of sounding more delusional :)
    >
    > -----Original Message-----
    > From: mmalc crawford [mailto:<mmalc_lists...>]
    > Sent: Tuesday, September 04, 2007 2:15 PM
    > To: Kevin Hoffman
    > Cc: <cocoa-dev...>
    > Subject: Re: Nested binding question
    >
    >
    > On Sep 4, 2007, at 10:52 AM, Kevin Hoffman wrote:
    >
    >> So, theoretically, were someone to try and do this kind of nested
    >> binding today using Tiger, how would they go about doing it?
    >>
    > It's not quite clear now exactly what you want.
    >
    > Is it the case that you have an array of Order objects managed by an
    > array controller (Orders Controller) and you want in a table view to
    > display the Order Items associated with the current selection in
    > Orders Controller?
    >
    > If so, you need a second array controller, to manage the selection.
    > Its Class Name will (obviously) be OrderItem, and you bind its Content
    > Array to [Orders Controller].selection.
    >
    > mmalc
  • Yeah, that's the idea.

    Order - shows up as a box
    Order Description - label
    Order Items - bound to a table view

    Order - shows up as a box
    Order Description - label
    Order Items - bound to a table view

    etc...

    -----Original Message-----
    From: Dominik Pich [mailto:<Dominik...>]
    Sent: Tuesday, September 04, 2007 2:26 PM
    To: Kevin Hoffman
    Cc: mmalc crawford; <cocoa-dev...>
    Subject: Re: Nested binding question

    Is it simply this?

    Order
    Item  -> view bound to Item.prop1 or prop2 and
    containingOrder
      prop1
      prop2
      ....
      articles array
      containingOrder
    Item  -> view bound to Item.prop1 or prop2 and
    containingOrder
      prop1
      prop2
      containingOrder
    Item  -> view bound to Item.prop1 or prop2 and
    containingOrder
      prop1
      prop2
      ....
      articles array
      containingOrder
    Item  -> view bound to Item.prop1 or prop2 and
    containingOrder
      prop1
      prop2
      ....
      articles array
      containingOrder

    If not / sorry I misunderstood :)
    Regards,
    Dominik

    Am 04.09.2007 um 20:17 schrieb Kevin Hoffman:

    > Actually what I need is the nested binding without having a current
    > selection.
    > So, I need some custom views where each view is bound to an element in
    > the Orders controller, and within each of those custom views, there
    > is a
    > table view that is bound to the orderItems mutable array property
    > on the
    > order item to which the view is bound.
    >
    > Hopefully that made it clearer instead of sounding more delusional :)
    >
    > -----Original Message-----
    > From: mmalc crawford [mailto:<mmalc_lists...>]
    > Sent: Tuesday, September 04, 2007 2:15 PM
    > To: Kevin Hoffman
    > Cc: <cocoa-dev...>
    > Subject: Re: Nested binding question
    >
    >
    > On Sep 4, 2007, at 10:52 AM, Kevin Hoffman wrote:
    >
    >> So, theoretically, were someone to try and do this kind of nested
    >> binding today using Tiger, how would they go about doing it?
    >>
    > It's not quite clear now exactly what you want.
    >
    > Is it the case that you have an array of Order objects managed by an
    > array controller (Orders Controller) and you want in a table view to
    > display the Order Items associated with the current selection in
    > Orders Controller?
    >
    > If so, you need a second array controller, to manage the selection.
    > Its Class Name will (obviously) be OrderItem, and you bind its Content
    > Array to [Orders Controller].selection.
    >
    > mmalc
  • On Sep 4, 2007, at 11:27 AM, Kevin Hoffman wrote:

    > Yeah, that's the idea.
    > Order - shows up as a box
    > Order Description - label
    > Order Items - bound to a table view
    > Order - shows up as a box
    > Order Description - label
    > Order Items - bound to a table view
    >
    If the table view is a subview of your custom view, I *think* the same
    principles apply as with my original reply:

    "... you need a second array controller, to manage the selection.
    Its Class Name will (obviously) be OrderItem, and you bind its Content
    Array to [Orders Controller].selection."

    The difference is that your custom view will itself need its own array
    controller, and when it (your custom view) is bound to its value, it
    will have to bind the Content Array of its array controller to the
    orderItems property of the value.

    mmalc
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today