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 (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 [EMAIL PROTECTED]

Reply via email to