FROM : Lee Morgan
DATE : Fri Apr 08 23:50:59 2005
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];
>> }
DATE : Fri Apr 08 23:50:59 2005
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];
>> }
| Related mails | Author | Date |
|---|---|---|
| Lee Morgan | Apr 8, 21:50 | |
| Ricky Sharp | Apr 8, 23:03 | |
| Tom Bradford | Apr 8, 23:11 | |
| Lee Morgan | Apr 8, 23:50 | |
| Lee Morgan | Apr 9, 03:21 |






Cocoa mail archive

