• 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: sorting an NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sorting an NSTableView


  • Subject: Re: sorting an NSTableView
  • From: Ken Worley <email@hidden>
  • Date: Fri, 30 May 2008 08:06:36 -0600


On May 30, 2008, at 12:48 AM, James W. Walker wrote:

Hi. I'm a Cocoa newbie, and I'm trying to figure out how to enable sorting columns of my table, but the NSTableView guide doesn't say anything about it. I see that NSTableView has a setSortDescriptors method, NSTableColumn has a setSortDescriptorPrototype method, and that IB shows a "sort key" attribute for a table column, but I'm not clear on how to use them. Any hints or examples?

I'm sure Vijay's solution is more correct than mine, but I implement the

-(void)tableView:(NSTableView *)tableView didClickTableColumn: (NSTableColumn *)tableColumn

delegate method and highlight the column header myself (reversing the sort as necessary and setting the right sort direction indicator). Then I sort my data source and call reloadData on the table object.

I found this MacTech article useful for getting to know NSTableView a little better also:

<http://www.mactech.com/articles/mactech/Vol.18/18.09/TableTechniques/index.html >

Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



_______________________________________________

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: 
 >sorting an NSTableView (From: "James W. Walker" <email@hidden>)

  • Prev by Date: Re: warning: 'NSEntityDescription' may not respond to
  • Next by Date: Re: Support saving to network volumes
  • Previous by thread: Re: sorting an NSTableView
  • Next by thread: NSURLConnection sendSynchronousRequest crash
  • Index(es):
    • Date
    • Thread