Re: Sorting problems with NSArrayController and a value transformer
Re: Sorting problems with NSArrayController and a value transformer
- Subject: Re: Sorting problems with NSArrayController and a value transformer
- From: Tom Birch <email@hidden>
- Date: Tue, 10 May 2005 16:50:13 +1000
I managed to solve this with a category for NSArray (implementing -
compare:), but I still don't understand why the value transformer
isn't being used to aid sorting
Tom
On 10/05/2005, at 15:57:45, Tom Birch wrote:
I have a master-detail view with a table view and some text fields
to display the current selection, all bound to an array controller,
with its content object class set to a custom class (Record) that
has an NSMutableDictionary instance variable (dict) and and some
other methods for actions, etc.
I'm populating the managed array with NSMetadataQuery, and
implementing the delegate method
(metadataQuery:replacementObjectForResultObject:) to return a
Record object populated with some of the attributes from the query
(particularly kMDItemTitle, kMDItemFSCreationDate and
kMDItemAuthors). For the column and the NSTextField that represent
the date, I have attached an NSDateFormatter which works fine, and
allows sorting. For the authors column and text field, I have used
a value transformer to convert the array of strings to a comma-
separated string, and the reverse operation for storing back in a
Record.
When I try to sort by either the Name or Date columns, it works
fine, but when I try to sort by the Authors column, I get this error:
2005-05-10 12:09:57.762 MyApp[4597] *** -[NSCFArray compare:]:
selector not recognized [self = 0x4d9c5c0]
debugging shows that self is an array containing strings, and I
also discovered that each array for the Author key contains only
It appears that the value transformer is not getting called for
sorting (I actually verified this by putting an NSLog() statement
inside my formatter), even though I have checked "creates sort
descriptor" in the binding option for the column where I set the
value transformer.
Basically, what am I doing wrong? My formatter is working correctly
because I've tested it both ways, and I've double-checked the
binding to make sure it's set to create the sort descriptor, I feel
like there's some crucial step that I'm missing.
cheers,
Tom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40cse.unsw.edu.au
This email sent to email@hidden
_______________________________________________
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