• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableColumn Binding Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableColumn Binding Question


  • Subject: Re: NSTableColumn Binding Question
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 30 Nov 2010 09:53:10 +0000


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 (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

References: 
 >NSTableColumn Binding Question (From: Peter Zegelin <email@hidden>)

  • Prev by Date: Reducer Sample Code
  • Next by Date: Re: aborting init
  • Previous by thread: NSTableColumn Binding Question
  • Next by thread: Text colour button problem in Font Panel
  • Index(es):
    • Date
    • Thread