Re: NSTableColumn Binding Question
Re: NSTableColumn Binding Question
- Subject: Re: NSTableColumn Binding Question
- From: Peter Zegelin <email@hidden>
- Date: Thu, 2 Dec 2010 12:57:28 +1100
Thanks Jonathan,
I thought this would be the case and your suggestion works well.
On 30/11/2010, at 8:53 PM, email@hidden wrote:
>
>
> On 30 Nov 2010, at 01:12, Peter Zegelin wrote:
>
>> Hi All,
>>
>> I have successfully bound most of the columns of my table to the contents of an arraycontroller but I have one column that needs to be treated differently.
>>
>> I would like the column to just display the row number of the item in the table (ie 1,2,3 etc.). Is it possible to do this by binding to something or do I need to do this in code?
>
> You can setup the table data source and have it respond to :
>
> - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
>
> All you have to do is wrap the rowIndex++ in a NSNumber instance and return it.
>
> You can define an index property on your model and bind to it if desired but it will have to be maintained.
> But the model really doesn't need to know anything about such things
> So I would use the datasource.
<snip>
Peter
_______________________________________________
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