Thanks Jonathan,

I thought this would be the case and your suggestion works well.


On 30/11/2010, at 8:53 PM, jonat...@mugginsoft.com 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to