Re: "to-many" bindings in Interface Builder
Re: "to-many" bindings in Interface Builder
- Subject: Re: "to-many" bindings in Interface Builder
- From: Allan Odgaard <email@hidden>
- Date: Sat, 17 Apr 2004 18:08:44 +0200
On 17. Apr 2004, at 10:48, John wrote:
I have a table of customers, each customer can have many invoices,
and each invoice can have many invoiceLineItems.
Is the goal to have 3 table views where the first show all customers,
the second show the invoices of the current customer and the third show
the lines of that invoice (i.e. just like an NSBrowser)?
In that case you need 3 array controllers and you need to bind the
'contentArray' of the third one (showing the invoice lines) to the
second one (showing the invoices) with a key path like
'selection.invoiceLines' -- where 'invoiceLines' is the key of the
invoice record/dictionary holding an invoice line array -- so each time
the selection is changed in the second array controller, the entire
content is changed in the third one.
Likewise bind 'contentArray' of the second array controller to
'selection.invoices' of the first array controller -- here 'invoices'
is the key in the customer record/dictionary holding the invoice array.
The first array controllers 'contentArray' is bound (or connected) to
where ever you store the array of all customers.
Finally bind the various table column values to the proper array
controllers.
Hope it helps...
** Cocoa FAQ: <
http://www.alastairs-place.net/cocoa/faq.txt> **
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.