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.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

_______________________________________________

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