• 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
[SOLVED] Re: NSTableColumn's sort key in Interface Builder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] Re: NSTableColumn's sort key in Interface Builder


  • Subject: [SOLVED] Re: NSTableColumn's sort key in Interface Builder
  • From: Mike Manzano <email@hidden>
  • Date: Mon, 30 Mar 2009 13:40:44 -0700

Doh!

On Mar 30, 2009, at 1:00 PM, Corbin Dunn wrote:


On Mar 30, 2009, at 12:16 PM, Mike Manzano wrote:

Hello,

I have a table view whose delegate's - tableView:objectValueForTableColumn:row: returns an NSDictionary with key value pairs that look like this for each of its columns (the columns' cells are responsible for extracting some subset of this dictionary to display to the user):

{
  xkDateModified = 2008-01-15 23:03:00 -0800;
  xkDisplayStatus = "Awaiting Pickup";
  xkFileName = "stuff.graffle";
  xkOwnerID = "email@hidden";
}

I'd like to make the "File Name" columns sortable, so I've set up the file name column's sort key to be xkFileName and the selector to be compare:. The sorting triangle appears in the header, but the column isn't being sorted.

I have verified using an NSLog() inside of - tableView:objectForTableColumn:row: that [resultObjectValue valueForKeyPath:@"xkFileName"] returns the proper file names.

What am I doing wrong?

Nothing! You have to just sort your model array in the controller yourself in:


- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange: (NSArray *)oldDescriptors AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

corbin



_______________________________________________

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's sort key in Interface Builder (From: Mike Manzano <email@hidden>)
 >Re: NSTableColumn's sort key in Interface Builder (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: Launching a preference pane from inside a Cocoa app
  • Next by Date: Re: Processing data maintained with Core Data
  • Previous by thread: Re: NSTableColumn's sort key in Interface Builder
  • Next by thread: Why does -[NSURLConnection start] crash?
  • Index(es):
    • Date
    • Thread