Hi All:
Is there a way to use NSNumericSearch as a parameter to a selector in a NSTableColumn?
For example, my data may be: BC-1, BC-2, BC-3... BC-9, BC-10, BC-11.
Obviously with just compare: as the selector, the data is sorted as: BC-1, BC-10, BC-11, BC-2... Not great and I don't want to force the user to enter the data as: BC-01, BC-02, etc...
I tried:
NSTableColumn *col = [columnArray objectAtIndex:colIndex];
NSSortDescriptor *sd = [[NSSortDescriptor alloc] initWithKey:@"catalogNumber"
ascending:YES
comparator:^NSComparisonResult(NSString *catNum1, NSString *catNum2) {
NSComparisonResult result = NSOrderedSame;
result = [catNum1 compare:catNum2 options:(NSNumericSearch | NSCaseInsensitiveSearch)];
return result;
}];
[col setSortDescriptorPrototype:sd];
But that doesn't work when you click on various, as it didn't seem to be called.
Is there a document or URL that describes how to get the sort I want?
Thanks very much
John