• 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 NSStrings in NSTableColumn (need 10 after 9)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting NSStrings in NSTableColumn (need 10 after 9)


  • Subject: Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
  • From: Lee Morgan <email@hidden>
  • Date: Fri, 8 Apr 2005 17:50:59 -0400

Sorry I should have been a bit more clear, part of the problem I'm having is adding the sorting code to my table. I can't seem to find any docs or simple examples on how to add the sorting function to my column - I'm guessing I have to subclass my column or is there a simple way to add it to my main app controller?

- lee


On Apr 8, 2005, at 5:11 PM, Tom Bradford wrote:

This is a little more difficult than that I think. You have two values in there that will cause problems for a standard numeric sort, the first one is '1/2' which I assume should be converted to a float 0.5 for sorting. The second one is 1A whose value is arbitrary. It could mean 1.0, 1.1, or 1 times A (where the value of A is 50). In your comparator, You'd have to account for these cases.

When comparing your strings, use the NSNumericSearch option
For example, in one of my model's compare: methods, I do this:
- (NSComparisonResult)compare:(IIStudent*)anotherStudent;
{
return [[self studentName] compare:[anotherStudent studentName]
options:NSLiteralSearch | NSNumericSearch | NSCaseInsensitiveSearch];
}

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
      • From: Lee Morgan <email@hidden>
References: 
 >Sorting NSStrings in NSTableColumn (need 10 after 9) (From: Lee Morgan <email@hidden>)
 >Re: Sorting NSStrings in NSTableColumn (need 10 after 9) (From: Ricky Sharp <email@hidden>)
 >Re: Sorting NSStrings in NSTableColumn (need 10 after 9) (From: Tom Bradford <email@hidden>)

  • Prev by Date: Re: ADC Core Data article
  • Next by Date: NSFileHandleReadCompletionNotification(s) not being posted when app is inactive
  • Previous by thread: Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
  • Next by thread: Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
  • Index(es):
    • Date
    • Thread