Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
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