• 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
Sorting an NSTableView bound to an NSArrayController.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting an NSTableView bound to an NSArrayController.


  • Subject: Sorting an NSTableView bound to an NSArrayController.
  • From: Robert Tillyard <email@hidden>
  • Date: Thu, 28 Jun 2012 16:44:17 +0100

Hello,

I'm writing an application that handles results for a running club.

I have an NSTableView that has columns bound to a CoreData Entity such as Entries.arrangedObjects.position, position is an NSString that contains numbers such as @"1" and @"2" or @"" but the position can also be @"DNF" (Did not finish).

I have a method in the WindowController that sorts the 'Entry' objects and handles these cases correctly returning an NSArray using:

   [array sortUsingComparator:^(id obj1, id obj2)
      {
      NSComparisonResult r;

      r = ....

      return (r);
      }];

How can I get my table view to work so that when the user clicks in the Pos. column I can do my custom sort? at present it is doing an ASCII sort so I get 1, 10, 100, then 2, 20, 200 etc...

I now I need to put a key and sort descriptor in IB but don't know what code I have to add to the Entity ot WindowController to handle it.


Thanks, regards, Rob.

_______________________________________________

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

  • Follow-Ups:
    • Re: Sorting an NSTableView bound to an NSArrayController.
      • From: Willeke <email@hidden>
  • Prev by Date: Re: 10.6 SDk and 10.5 Deployment
  • Next by Date: Re: Transparent NSTextField
  • Previous by thread: Re: Transparent NSTextField
  • Next by thread: Re: Sorting an NSTableView bound to an NSArrayController.
  • Index(es):
    • Date
    • Thread