Re: computing values within NSTableView using bindings
Re: computing values within NSTableView using bindings
- Subject: Re: computing values within NSTableView using bindings
- From: Quincey Morris <email@hidden>
- Date: Thu, 21 Apr 2011 20:41:28 -0700
On Apr 21, 2011, at 14:10, Guy Steven wrote:
> I have an NSTableView with 3 columns.
>
>
> The first contains an NSPop-up which takes as its datasource an array of
> objects with two properties, name and cost. The name is displayed.
>
> The user enters a quantity in the 2nd column.
>
> How do I go about displaying the cost in the third column? I can bind that
> column to the quantity key, but don't then know the cost, or I can bind the
> column to get the cost, but don't then know the quantity?
The simplest way is to create a derived property:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ModelObjects/Articles/moIntegrating.html
You can put this derived property in your data model, or if that doesn't make sense in your application, in the window controller for the window with the table.
_______________________________________________
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